Specifications
Sun Services
Java™ Programming Language
Module 11, slide 20 of 22
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Event Handling Using Inner Classes
19
20 public void launchFrame() {
21 Label label = new Label("Click and drag the mouse");
22 // Add components to the frame
23 f.add(label, BorderLayout.NORTH);
24 f.add(tf, BorderLayout.SOUTH);
25 // Add a listener that uses an Inner class
26 f.addMouseMotionListener(new MyMouseMotionListener());
27 f.addMouseListener(new MouseClickHandler());
28 // Size the frame and make it visible
29 f.setSize(300, 200);
30 f.setVisible(true);
31 }
32
33 public static void main(String args[]) {
34 TestInner obj = new TestInner();
35 obj.launchFrame();
36 }
37 }










