-
Notifications
You must be signed in to change notification settings - Fork 2
/
MainDisplay.java
115 lines (100 loc) · 2.92 KB
/
MainDisplay.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
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
package Undergraduate_Project;
//This is a test change_2
import java.awt.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
import javax.swing.border.MatteBorder;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.awt.event.ActionEvent;
import java.awt.Image.*;
import java.util.*;
//Files
import Undergraduate_Project.CarPanelGUI;
import Undergraduate_Project.FloorPanelGUI;
import Undergraduate_Project.PistonPanelGUI;
import Undergraduate_Project.InputPanelGUI;
import Undergraduate_Project.ControlSystem;
public class MainDisplay {
private JFrame frame;
private static PistonPanelGUI pp;
private static FloorPanelGUI fp;
private static CarPanelGUI cp;
private static InputPanelGUI ip;
//private static ControlSystem cs = new ControlSystem();
//private static ElevatorCarPiston daPiston = new ElevatorCarPiston();
private static ControlSystem cs;
/**
* Launch the application.
*/
public static void main(String[] args) throws InterruptedException{
/*EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainDisplay window = new MainDisplay();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});*/
/**
* Control Application from here
*/
// Gary modified Dec 8 16:01//
MainDisplay window = new MainDisplay();
window.frame.setVisible(true);
Thread t = new Thread((Runnable) cs);
t.start();
cs = new ControlSystem(pp, fp, cp, ip);
/*for(double x = 0; x<41;x=x+1.6){//This is for a test. Use a while loop when running full program
Thread.sleep(1000);
pp.piston_main(x);
System.out.println(x);
}*/
while(true){
cs.run();
System.out.println();
//pp.piston_rep(cs.getElevatorPosition());
}
/*
for(int i=0;i<26;i++){
Thread.sleep(1000);
pp.setPiston(i);
}*/
}
/**
* Create the application.
*/
public MainDisplay() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
// creates main application window
frame = new JFrame("Undergrad Elevator Control System");
frame.setBounds(100, 100, 1190, 763);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
// creates the beginning piston panel
pp = new PistonPanelGUI();
frame.getContentPane().add(pp);
// creates the beginning floor panel
fp = new FloorPanelGUI();
frame.getContentPane().add(fp);
// creates the beginning elevator car panel
cp = new CarPanelGUI();
frame.getContentPane().add(cp);
// creates the beginning test input panel
ip = new InputPanelGUI();
ip.setSize(207, 695);
ip.setLocation(953, 13);
frame.getContentPane().add(ip);
}
}