-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainapp.java
More file actions
178 lines (151 loc) · 8.77 KB
/
Copy pathmainapp.java
File metadata and controls
178 lines (151 loc) · 8.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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import javax.swing.*;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
public class MainApp extends JFrame {
static CardLayout cardLayout;
static JPanel mainPanel;
static Map<String, JPanel> panelMap;
static boolean isAuthenticated = false;
public MainApp() {
setTitle("RË Resource Hub");
setSize(1024, 768);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cardLayout = new CardLayout();
mainPanel = new JPanel(cardLayout);
panelMap = new HashMap<>();
panelMap.put("Home", new HomePanel());
panelMap.put("Resources", new ResourcePanel());
panelMap.put("Contests", new ContestPanel());
panelMap.put("Login", new LoginPanel());
panelMap.put("Dashboard", new DashboardPanel());
panelMap.put("Help", new HelpPanel());
panelMap.put("About", new AboutPanel());
panelMap.put("Settings", new SettingsPanel());
panelMap.put("Feedback", new FeedbackPanel());
panelMap.put("Admin", new AdminPanel());
panelMap.put("Profile", new ProfilePanel());
panelMap.put("Resume", new ResumeSubmissionPanel());
panelMap.put("Investment", new InvestmentPanel());
panelMap.put("Communication", new CommunicationPanel());
for (Map.Entry<String, JPanel> entry : panelMap.entrySet()) {
mainPanel.add(entry.getValue(), entry.getKey());
}
add(mainPanel);
cardLayout.show(mainPanel, "Home");
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
MainApp app = new MainApp();
app.setVisible(true);
});
}
class HomePanel extends JPanel {
public HomePanel() {
setLayout(new BorderLayout());
JLabel welcomeLabel = new JLabel("Welcome to RË Resource Hub", JLabel.CENTER);
welcomeLabel.setFont(new Font("Arial", Font.BOLD, 24));
add(welcomeLabel, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel(new GridLayout(2, 3));
JButton resourcesButton = new JButton("Browse Resources");
resourcesButton.addActionListener(e -> cardLayout.show(mainPanel, "Resources"));
buttonPanel.add(resourcesButton);
JButton contestButton = new JButton("View Contests");
contestButton.addActionListener(e -> cardLayout.show(mainPanel, "Contests"));
buttonPanel.add(contestButton);
JButton loginButton = new JButton("Login");
loginButton.addActionListener(e -> cardLayout.show(mainPanel, "Login"));
buttonPanel.add(loginButton);
JButton helpButton = new JButton("Help & Support");
helpButton.addActionListener(e -> cardLayout.show(mainPanel, "Help"));
buttonPanel.add(helpButton);
JButton aboutButton = new JButton("About Us");
aboutButton.addActionListener(e -> cardLayout.show(mainPanel, "About"));
buttonPanel.add(aboutButton);
JButton feedbackButton = new JButton("Feedback");
feedbackButton.addActionListener(e -> cardLayout.show(mainPanel, "Feedback"));
buttonPanel.add(feedbackButton);
add(buttonPanel, BorderLayout.SOUTH);
}
}
class ResourcePanel extends JPanel {
private JTextArea resourceList;
public ResourcePanel() {
setLayout(new BorderLayout());
JLabel resourcesLabel = new JLabel("Browse Free Resources", JLabel.CENTER);
resourcesLabel.setFont(new Font("Arial", Font.BOLD, 20));
add(resourcesLabel, BorderLayout.NORTH);
resourceList = new JTextArea(20, 50);
resourceList.setEditable(false);
resourceList.setText(fetchResources());
add(new JScrollPane(resourceList), BorderLayout.CENTER);
JPanel searchPanel = new JPanel(new GridLayout(0, 2));
searchPanel.add(new JLabel("Search:"));
JTextField searchField = new JTextField();
searchField.addActionListener(e -> searchResources(searchField.getText()));
searchPanel.add(searchField);
add(searchPanel, BorderLayout.SOUTH);
}
private String fetchResources() {
return "1. Debian: https://www.debian.org/\n" +
"2. Ubuntu: https://ubuntu.com/\n" +
"3. Fedora: https://getfedora.org/\n" +
"4. mergerfs: https://github.com/trapexit/mergerfs\n" +
"5. snapraid: http://www.snapraid.it/\n" +
"6. Compute Express Link (CXL): https://www.computeexpresslink.org/\n" +
"7. Geopotential Height Analysis: http://www.bom.gov.au/australia/charts/viewer/index.shtml?type=pressureHgt&level=850hPa&tz=AEDT&area=G&model=G&chartSubmit=Refresh+View\n" +
"8. NOAA Experimental Products: https://www.swpc.noaa.gov/products\n" +
"9. Spyder: https://www.spyder-ide.org/\n" +
"10. Anaconda: https://www.anaconda.com/\n" +
"11. TensorFlow: https://www.tensorflow.org/\n" +
"12. PyTorch: https://pytorch.org/\n" +
"13. MATLAB for free: https://github.com/kamyu104/Leetcode-Python/wiki/How-to-install-MATLAB-for-free\n" +
"14. WindowsXPE: https://win10se.cwcodes.net/Compressed/index.php?version=231120\n" +
"15. Radeon DATARAM RAMDisk: https://www.radeon.com/en-us/software/ramdisk\n" +
"16. qBittorrent: https://www.qbittorrent.org/\n" +
"17. Visual Studio Code: https://code.visualstudio.com/\n" +
"18. Visual Studio Community Edition: https://visualstudio.microsoft.com/vs/community/\n" +
"19. Defraggler: https://www.ccleaner.com/defraggler\n" +
"20. Android Secret Codes: https://www.techworm.net/2019/06/android-secret-codes.html\n" +
"21. iPhone Field Test: https://www.techworm.net/2018/10/iphone-hidden-dialer-codes.html\n" +
"22. TakeOwnershipPro: https://www.tweaking.com/content/page/take_ownership.html\n" +
"23. USGS Strategic Minerals Report: https://pubs.usgs.gov/pp/1802/pp1802_entirebook.pdf\n" +
"24. CLIPS: https://sourceforge.net/projects/clipsrules/\n" +
"25. Emergent: https://grey.colorado.edu/emergent/index.php/Main_Page\n" +
"26. Free for Dev: https://github.com/ripienaar/free-for-dev?tab=readme-ov-file#paas\n" +
"27. GPT4ALL: https://gpt4all.io/\n";
}
private void searchResources(String query) {
String resources = fetchResources();
StringBuilder result = new StringBuilder();
for (String line : resources.split("\n")) {
if (line.toLowerCase().contains(query.toLowerCase())) {
result.append(line).append("\n");
}
}
resourceList.setText(result.toString());
}
}
class ContestPanel extends JPanel {
public ContestPanel() {
setLayout(new BorderLayout());
JLabel contestLabel = new JLabel("Current Contests", JLabel.CENTER);
contestLabel.setFont(new Font("Arial", Font.BOLD, 20));
add(contestLabel, BorderLayout.NORTH);
JTextArea contestDetails = new JTextArea(20, 50);
contestDetails.setText(getContestDescriptions());
add(new JScrollPane(contestDetails), BorderLayout.CENTER);
JButton backButton = new JButton("Back to Home");
backButton.addActionListener(e -> cardLayout.show(mainPanel, "Home"));
add(backButton, BorderLayout.SOUTH);
JButton enterContestButton = new JButton("Enter Contest");
enterContestButton.addActionListener(e -> showContestForm());
add(enterContestButton, BorderLayout.SOUTH);
}
private String getContestDescriptions() {
return "Contest 1: Repurposed Compute, Wasted Compute, or Innovation via Component Dismantling\n" +
"Description: Can you build something worthwhile out of things broken, old, or being thrown away? " +
"Can you build something computing with an unused resource, like the wind, existing DNS infrastructure, or magnetic fields?\n" +
"Prize: $1,000 USD cash, company stock, a part-time or full-time job offer.\n" +
"To be disseminated to high schools but open to the general public, no matter the age.\n\n" +
"Contest 2: Artisanal Technological Innovation\n" +