import java.applet.*; import java.awt.*; public class applet14 extends Applet { Rectangle r = new Rectangle(10,30,20,20); boolean dedans; 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) { dedans =(r.inside(x,y)) ? true : false; if (dedans) { t="Oui"; T.setText(t); } return true; } public boolean mouseUp(Event evt, int x, int y) { t="Non"; T.setText(t); return true; } }