public class TestRectangle { public static void main(String[] args) { JFrame f = new JFrame("Fond"); f.setSize(700, 200); f.setLocation(100, 100); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Rectangle r = new Rectangle(); r.addMouseMotionListener(new Observer()); f.setVisible(true); } }