public class Scribble extends JFrame
1:
2: package scribble1;
3:
4: import java.awt.*;
5: import java.awt.event.*;
6: import javax.swing.*;
7:
8: public class Scribble extends JFrame {
9:
10: public Scribble() {
11: setTitle("Scribble Pad");
12: canvas = new ScribbleCanvas();
13: canvas.setBackground(Color.white);
14: getContentPane().setLayout(new BorderLayout());
15: getContentPane().add(canvas, BorderLayout.CENTER);
16: addWindowListener(new WindowAdapter() {
17: public void windowClosing(WindowEvent e) {
18: System.exit(0);
19: }
20: });
21: }
22:
23: public static void main(String[] args) {
24: int width = 600;
25: int height = 400;
26: JFrame frame = new Scribble();
27: frame.setSize(width, height);
28: Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
29: frame.setLocation(screenSize.width/2 - width/2,
30: screenSize.height/2 - height/2);
31: frame.show();
32: }
33:
34: protected ScribbleCanvas canvas;
35:
36: }