-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.java
More file actions
56 lines (46 loc) · 1.77 KB
/
Driver.java
File metadata and controls
56 lines (46 loc) · 1.77 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
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JPanel;
public class Driver extends Frame implements WindowListener,ActionListener {
Button loginButton;
Button newUserButton;
Server storedInfo = new Server();
public static void main(String[] args) {
Driver myWindow = new Driver();
myWindow.setSize(700,500);
myWindow.setVisible(true);
}
public ArrayList<User> getServer(){
return storedInfo.users;
}
public Driver() {
setLayout(new FlowLayout());
addWindowListener(this);
loginButton = new Button("Login");
add(loginButton);
loginButton.addActionListener(this);
newUserButton = new Button("Create new user");
add(newUserButton);
newUserButton.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == loginButton) {
LoginWindow nw = new LoginWindow();
}
if(e.getSource() == newUserButton) {
MakeNew win = new MakeNew();
}
}
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
public void windowOpened(WindowEvent e) {}
public void windowActivated(WindowEvent e) {}
public void windowIconified(WindowEvent e) {}
public void windowDeiconified(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
public void windowClosed(WindowEvent e) {}
}