public class Painter
1: // Fig. 11.34: Painter.java
2: // Testing PaintPanel.
3: import java.awt.BorderLayout;
4: import javax.swing.JFrame;
5: import javax.swing.JLabel;
6:
7: public class Painter
8: {
9: public static void main( String args[] )
10: {
11: // create JFrame
12: JFrame application = new JFrame( "A simple paint program" );
13:
14: PaintPanel paintPanel = new PaintPanel(); // create paint panel
15: application.add( paintPanel, BorderLayout.CENTER ); // in center
16:
17: // create a label and place it in SOUTH of BorderLayout
18: application.add( new JLabel( "Drag the mouse to draw" ),
19: BorderLayout.SOUTH );
20:
21: application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
22: application.setSize( 400, 200 ); // set frame size
23: application.setVisible( true ); // display frame
24: } // end main
25: } // end class Painter
26:
27:
28: /**************************************************************************
29: * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and *
30: * Pearson Education, Inc. All Rights Reserved. *
31: * *
32: * DISCLAIMER: The authors and publisher of this book have used their *
33: * best efforts in preparing the book. These efforts include the *
34: * development, research, and testing of the theories and programs *
35: * to determine their effectiveness. The authors and publisher make *
36: * no warranty of any kind, expressed or implied, with regard to these *
37: * programs or to the documentation contained in these books. The authors *
38: * and publisher shall not be liable in any event for incidental or *
39: * consequential damages in connection with, or arising out of, the *
40: * furnishing, performance, or use of these programs. *
41: *************************************************************************/