Specifications

Sun Services
Java™ Programming Language
Module 11, slide 14 of 22
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Complex Example
13
14 public void launchFrame() {
15 Label label = new Label("Click and drag the mouse");
16 // Add components to the frame
17 f.add(label, BorderLayout.NORTH);
18 f.add(tf, BorderLayout.SOUTH);
19 // Add this object as a listener
20 f.addMouseMotionListener(this);
21 f.addMouseListener(this);
22 // Size the frame and make it visible
23 f.setSize(300, 200);
24 f.setVisible(true);
25 }