-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaintFrame.java
48 lines (47 loc) · 1.36 KB
/
PaintFrame.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.GraphicsEnvironment;
import java.awt.event.*;
import java.awt.font.TextAttribute;
import java.io.*;
import java.util.*;
import java.util.Scanner;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.*;
import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;
import javax.swing.filechooser.*;
import javax.swing.undo.*;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.UndoManager;
class PaintFrame extends JFrame
{
private JPanel toolPanel;
private JPanel finalPanel;
private DrawingPanel d;
private ToolBox toolbox;
public PaintFrame()
{
setSize(800, 700);
finalPanel = new JPanel();
finalPanel.setLayout(new BorderLayout());
toolPanel = new JPanel();
d = new DrawingPanel();
toolbox = new ToolBox();
JButton bt = new JButton("Clear");
bt.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
d.clear();
}
});
finalPanel.add(bt, BorderLayout.SOUTH);
finalPanel.add(toolbox, BorderLayout.WEST);
finalPanel.add(d,BorderLayout.EAST);
add(finalPanel);
pack();
}
}