-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTreeDraw3D.java
43 lines (31 loc) · 923 Bytes
/
TreeDraw3D.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
/**
* BasicDraw.java
*
*
* Template for beginning graphics programs.
*
*/
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.*;
public class TreeDraw3D
{
public static void main(String[] args){
TreeWorld myCanvas = new TreeWorld();
TreeWorldControlPanel control = new TreeWorldControlPanel(myCanvas);
JFrame myFrame = new JFrame();
Container cp = myFrame.getContentPane();
cp.setLayout(new BorderLayout());
cp.add(myCanvas, BorderLayout.CENTER);
cp.add(control,BorderLayout.EAST);
myFrame.setTitle("Tree 3D");
myFrame.setSize(500,500);
//Sets the window to close when upper right corner clicked.
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Must use getContentPane() with JFrame.
myFrame.add(myCanvas);
myFrame.pack(); //resizes to preferred size for components.
myFrame.setResizable(true);
myFrame.setVisible(true);
}
}