-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainPanel.java
More file actions
46 lines (39 loc) · 1.37 KB
/
Copy pathmainPanel.java
File metadata and controls
46 lines (39 loc) · 1.37 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
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class mainPanel extends JFrame {
private JPanel panel1;
private JButton iAmOrganiserButton;
private JButton iAmAUserButton;
public mainPanel(){
// initialize panel settings
setContentPane(panel1);
setTitle("Main Panel");
setSize(500,500);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
iAmOrganiserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// if you click "i am organiser button"
//main panel closes and organiser panel opens
organiserPanel organiserPanel = new organiserPanel();
organiserPanel.setVisible(true);
setVisible(false);
}
});
iAmAUserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// if you click "i am user button"
//main panel closes and organiser panel opens
userInfoPanel userInfoPanel = new userInfoPanel();
userInfoPanel.setVisible(true);
setVisible(false);
}
});
}
public static void main(String[] args) {
mainPanel mainPanel = new mainPanel();
}
}