import java.applet.*; import java.awt.*; public class applet14 extends Applet { Rectangle r = new Rectangle(10,30,20,20); boolean intra; String t = new String(""); TextField T = new TextField(t, 5); public void init() { add(T); } public void paint(Graphics g) { g.setColor(Color.black); g.fillRect(r.x,r.y,r.width,r.height); } public boolean mouseDown(Event evt, int x, int y) { intra =(r.inside(x,y)) ? true : false; if (intra) { t="Si"; T.setText(t); } return true; } public boolean mouseUp(Event evt, int x, int y) { t="Non"; T.setText(t); return true; } }