-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvancedMasterApp.java
115 lines (97 loc) · 4.31 KB
/
AdvancedMasterApp.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
import org.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.api.skin.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class AdvancedMasterApp {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
try {
UIManager.setLookAndFeel(new SubstanceLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
JFrame frame = new JFrame("Master App");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(960, 1080);
frame.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 20));
// Welcome address
JTextArea welcomeArea = new JTextArea("Welcome to the Online Voting System!\n\n" +
"We are delighted to have you here as we embark on a journey of civic engagement and democratic participation. " +
"This platform is designed to make the voting process seamless and accessible to all. Whether you are an " +
"administrator overseeing elections, a voter ready to cast your ballot, or an enthusiast checking out the " +
"election results, our system is here to empower you. Thank you for being a part of this digital democracy, " +
"and we hope you find your experience both convenient and meaningful.");
welcomeArea.setEditable(false);
welcomeArea.setWrapStyleWord(true);
welcomeArea.setLineWrap(true);
welcomeArea.setPreferredSize(new Dimension(800, 400));
frame.add(welcomeArea);
JButton adminButton = new JButton("Admin App");
JButton voterButton = new JButton("Voter Login App");
JButton votingButton = new JButton("Voting Portal");
JButton resultsButton = new JButton("Election Results App");
// Set preferred size for one button
Dimension buttonSize = new Dimension(150, 40);
adminButton.setPreferredSize(buttonSize);
// Apply preferred size to other buttons
voterButton.setPreferredSize(buttonSize);
votingButton.setPreferredSize(buttonSize);
resultsButton.setPreferredSize(buttonSize);
frame.add(adminButton);
frame.add(voterButton);
frame.add(votingButton);
frame.add(resultsButton);
adminButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
launchAdminApp();
}
});
voterButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
launchVoterLoginApp();
}
});
votingButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
launchVotingPortal();
}
});
resultsButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
launchElectionResultsApp();
}
});
frame.setVisible(true);
});
}
private static void launchAdminApp() {
SwingUtilities.invokeLater(() -> {
AdminApp adminApp = new AdminApp();
adminApp.main(new String[]{});
});
}
private static void launchVoterLoginApp() {
SwingUtilities.invokeLater(() -> {
VoterLoginApp voterLoginApp = new VoterLoginApp();
voterLoginApp.main(new String[]{});
});
}
private static void launchVotingPortal() {
SwingUtilities.invokeLater(() -> {
VotingPortal votingPortal = new VotingPortal();
votingPortal.main(new String[]{});
});
}
private static void launchElectionResultsApp() {
SwingUtilities.invokeLater(() -> {
ElectionResultsApp electionResultsApp = new ElectionResultsApp();
electionResultsApp.main(new String[]{});
});
}
}