-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathACanvas.java
More file actions
71 lines (62 loc) · 1.84 KB
/
Copy pathACanvas.java
File metadata and controls
71 lines (62 loc) · 1.84 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import java.awt.*;
import java.util.*;
import javax.swing.*;
public class ACanvas extends JPanel {
private Containable container;
private boolean isControllerCanvas;
private Object params;
/**Default Contstructor for the ACanvas Class
* Handles the creation of a completely new ACanvas
*/
public ACanvas(){
super();
this.setLayout(null);
this.setVisible(true);
container = new Containable();
}
/**Convienience Constructor for creating ACanvases quickly
* Parameters follow .setBounds order with an added Color parameter at the end
*/
public ACanvas(int x, int y, int width, int hieght, Color c){
super();
this.setBounds(x,y,width,hieght);
this.setBackground(c);
this.setLayout(null);
this.setVisible(true);
container = new Containable();
}
/**Constructor for creating an ACanvas based on another ACanvas
* Purely for creating a new version of a previosly used ACanvas in order to completely refresh it
*/
public ACanvas(Containable c){
super();
this.setLayout(null);
this.setVisible(true);
container = c;
}
public Containable getContainable(){
return container;
}
public boolean getIsController(){
return this.isControllerCanvas;
}
public void paint(){
Iterator<Component> it = container.getList().iterator();
while(it.hasNext()){super.add(it.next());}
this.repaint();
}
public void add(Canvas c){
c.setIgnoreRepaint(false);
container.add(c);
}
public void add(ACanvas c){
container.add(c);
}
public void flatten(){
this.paint();
container = new Containable();
}
public void configureBufferStrategy(){
//TODO
}
}