-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMainWindow.java
73 lines (54 loc) · 1.75 KB
/
MainWindow.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Created by Iason Koulas (ik5g15)
*/
import javax.swing.*;
import java.awt.*;
public class MainWindow extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private Integer windowHeight;
private Integer windowWidth;
public MainWindow(int height, int width, String name) {
super(name);
this.windowHeight = height;
this.windowWidth = width;
this.setSize(windowWidth, windowHeight);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
/**
* Main Panel // BorderLayout
*/
JPanel mwindow = new JPanel();
mwindow.setLayout(new BorderLayout());
mwindow.setBackground(Color.GRAY);
mwindow.setVisible(true);
//Area that the doily will be drawn
DoilyArea doilyArea = new DoilyArea();
doilyArea.setPreferredSize(new Dimension(this.windowWidth / 2, this.windowHeight));
// Options Panel
JPanel options = new JPanel();
options.setPreferredSize(new Dimension(this.windowWidth / 3, this.windowHeight));
// options.setLayout(new GridLayout(2, 1));
options.setLayout(new FlowLayout());
options.setBackground(Color.GRAY);
// Gallery
Gallery gallery = new Gallery();
gallery.setPreferredSize(new Dimension(this.windowWidth / 3, this.windowHeight / 2));
gallery.setVisible(true);
// Buttons
ControlPanel buttons = new ControlPanel(this, doilyArea, gallery);
buttons.setPreferredSize(new Dimension(this.windowWidth / 3, this.windowHeight / 2));
JLabel galTitle = new JLabel("Gallery:");
JLabel optTitle = new JLabel("Options:");
options.add(galTitle);
options.add(gallery);
options.add(optTitle);
options.add(buttons);
mwindow.add(options, BorderLayout.WEST);
mwindow.add(doilyArea, BorderLayout.CENTER);
this.add(mwindow);
this.pack();
}
}