-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawArea.java
More file actions
45 lines (33 loc) · 786 Bytes
/
DrawArea.java
File metadata and controls
45 lines (33 loc) · 786 Bytes
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
import java.util.*;
import java.awt.*;
import javax.swing.*;
public class DrawArea extends JPanel
{
protected ArrayList<MiscImage> images = new ArrayList<MiscImage>();
public DrawArea(int width, int height)
{
this.setPreferredSize(new Dimension(width, height));
}
public void add(MiscImage img)
{
images.add(img);
}
public void add(ArrayList<MiscImage> imgList)
{
for(int i = 0; i < imgList.size(); i++)
{
images.add(imgList.get(i));
}
}
public void paintComponent(Graphics g)
{
for(int i = 0; i < images.size(); i++)
{
images.get(i).draw(g);
}
}
public void revert()
{
images = new ArrayList<MiscImage>();
}
}