-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMotherFrame.java
More file actions
136 lines (104 loc) · 3.41 KB
/
MotherFrame.java
File metadata and controls
136 lines (104 loc) · 3.41 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package white;
import red.*;
import javax.swing.*;
import controlsFrame.ControlsFrame_Mother;
import gateFrame.GateFrame_Mother;
import generalInfoFrame.GeneralInfoFrame_Mother;
import graphFrame.GraphFrame_Mother;
import gray.Global;
import java.awt.*;
import java.awt.event.*;
public class MotherFrame extends JFrame{
JDesktopPane jdpDesktop;
static int openframes = 0; // To keep track of how many frames are open at the moment
GateFrame_Mother mainpanelmother;
GraphFrame_Mother graphpanelmother;
GeneralInfoFrame_Mother generalinfomother;
ControlsFrame_Mother controlsframemother;
JMenu mainpanelmothermenu;
JMenu graphpanelmothermenu;
JMenu generalinfomothermenu;
JMenu controlsmothermenu;
JMenuItem menuitem_gate;
JMenuItem pricegraph;
JMenuItem graphpanelMI2;
JMenuItem generalinfoMI1;
JMenuItem generalinfoMI2;
JMenuItem controller;
JMenuBar menubar;
BorderLayout borderlayout;
public MotherFrame() {
setMotherFrame();
createMenuBar();
addMenuBar();
setInternalFramework();
createDefaultInternalFrames();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
private void createDefaultInternalFrames() {
jdpDesktop.add(new GateFrame_Mother());
jdpDesktop.add(new GeneralInfoFrame_Mother());
jdpDesktop.add(new GraphFrame_Mother());
}
private void setInternalFramework() {
jdpDesktop = new JDesktopPane();
setContentPane(jdpDesktop);
jdpDesktop.putClientProperty("JDesktopPane.dragMode", "outline");
}
private void setMotherFrame() {
borderlayout = new BorderLayout();
setLayout(borderlayout);
setSize(1024, 768);
this.setBounds(0, 0, 1600, 1000);
this.setVisible(true);
}
private void addMenuBar() {
add(menubar, BorderLayout.NORTH);
setJMenuBar(menubar);
}
private void createMenuBar() {
menubar = new JMenuBar();
mainpanelmothermenu = new JMenu("Main");
graphpanelmothermenu = new JMenu("Graph");
generalinfomothermenu = new JMenu("General Info");
controlsmothermenu = new JMenu("Control Center");
menuitem_gate = new JMenuItem("Gate");
menuitem_gate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Creating GateFrame_Mother");
if(e.getSource() != null) {
jdpDesktop.add(new GateFrame_Mother());
}
}
});
pricegraph = new JMenuItem("pricegraph");
pricegraph.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Creating Price Graph");
jdpDesktop.add(new GraphFrame_Mother());
}
});
graphpanelMI2 = new JMenuItem("graphpanelMI2");
generalinfoMI1 = new JMenuItem("General Stock Information");
generalinfoMI1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Creating GeneralInfoFrame_Mother");
if(e.getSource() != null) {
jdpDesktop.add(new GeneralInfoFrame_Mother());
}
}
});
generalinfoMI2 = new JMenuItem("Price Information");
controller = new JMenuItem("Controller");
mainpanelmothermenu.add(menuitem_gate);
graphpanelmothermenu.add(pricegraph);
graphpanelmothermenu.add(graphpanelMI2);
generalinfomothermenu.add(generalinfoMI1);
generalinfomothermenu.add(generalinfoMI2);
controlsmothermenu.add(controller);
menubar.add(mainpanelmothermenu);
menubar.add(graphpanelmothermenu);
menubar.add(generalinfomothermenu);
menubar.add(controlsmothermenu);
}
}