-
Notifications
You must be signed in to change notification settings - Fork 2
/
JobSeekerHomeView.java
236 lines (206 loc) · 8.89 KB
/
JobSeekerHomeView.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
package org.employable.View;
//import org.employable.Controller;
//import org.employable.Controller.JobSeekerController;
//import org.employable.Controller.RecruiterController;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.net.URI;
public class JobSeekerHomeView extends javax.swing.JFrame{
private static final long serialVersionUID = 1L;
public static String[] searchParamaters = {"Company", "Location", "Role", "Industry"};
public JobSeekerHomeView(){
//create the frame
JFrame frame = new JFrame("Home Page");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500,500);
//Create search panel
JPanel panel = new JPanel();
//Profile button
JButton profile = new JButton("Profile");
JTextField universalSearchBox = new JTextField("Search Company", 10);
//Combo box for search parameters
JComboBox<String> searchList = new JComboBox<>(searchParamaters);
//Search button
JButton search = new JButton("Search");
profile.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
//connect to job seeker profile via the controller
//JobSeekerController.loadProfileView();
// display/center the jdialog when the button is pressed
JOptionPane.showMessageDialog(frame,"You have chosen to go to your profile.");
}
});
search.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
// display/center the jdialog when the button is pressed
String company = universalSearchBox.getText();
//display job listings based on the user's search
JOptionPane.showMessageDialog(frame,"You searched for "+ company);
}
});
panel.add(profile);
panel.add(universalSearchBox);
panel.add(searchList);
panel.add(search);
//create panel for job listings
JPanel jobRecPanel = new JPanel();
JEditorPane jobLink1 = new JEditorPane();
jobRecPanel.setLayout(new GridLayout(2,3));
//section header with left justification
JLabel jobListings = new JLabel("Recommended Jobs for You");
JLabel blank = new JLabel("");
JLabel anotherBlank = new JLabel("");
jobRecPanel.add(jobListings);
jobRecPanel.add(blank);
jobRecPanel.add(anotherBlank);
//add listing with links
jobLink1.setEditable(false);//make text box uneditable
jobLink1.setContentType("text/html");
StringBuilder link1 = new StringBuilder();
//get the listings from the model/controller
link1.append("Comcast<br>");
link1.append("Software Engineer - Xfi Team<br>");
link1.append("Philadelphia, PA<br>");
link1.append("<a href='https://jobs.comcast.com'>https://jobs.comcast.com</a>");
jobLink1.setText(link1.toString());
//allow the hyperlink to be clickable
jobLink1.addHyperlinkListener(e ->{
if(HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())){
System.out.println(e.getURL());
Desktop desktop = Desktop.getDesktop();
try{
desktop.browse(e.getURL().toURI());
} catch(Exception ex){
ex.printStackTrace();
}
}
});
//format the text pane
jobLink1.setPreferredSize(new Dimension(300,100));
jobLink1.setBorder(BorderFactory.createLineBorder(Color.CYAN, 5));
//add the pane to the panel
jobRecPanel.add(jobLink1);
//second job listing with link
JEditorPane jobLink2 = new JEditorPane();
jobLink2.setEditable(false); //noneditable
jobLink2.setContentType("text/html");
StringBuilder link2 = new StringBuilder();
link2.append("Adobe<br>");
link2.append("UX Designer<br>");
link2.append("San Fransisco, CA<br>");
link2.append("<a href='https://www.adobe.com/careers.html'>https://www.adobe.com/careers.html</a>");
jobLink2.setText(link2.toString());
//make link clickable
jobLink2.addHyperlinkListener(e ->{
if(HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())){
System.out.println(e.getURL());
Desktop desktop = Desktop.getDesktop();
try{
desktop.browse(e.getURL().toURI());
} catch(Exception ex){
ex.printStackTrace();
}
}
});
//format the text pane
jobLink2.setPreferredSize(new Dimension(200,100));
jobLink2.setBorder(BorderFactory.createLineBorder(Color.CYAN, 5));
//add the pane to the panel
jobRecPanel.add(jobLink2);
//third job listing with link
JEditorPane jobLink3 = new JEditorPane();
jobLink3.setEditable(false);//noneditable
jobLink3.setContentType("text/html");
StringBuilder link3 = new StringBuilder();
link3.append("Google<br>");
link3.append("Engineering Rotational Program<br>");
link3.append("New York City, NY<br>");
link3.append("<a href='https://careers.google.com'>https://careers.google.com </a>");
jobLink3.setText(link3.toString());
//make link clickable
jobLink3.addHyperlinkListener(e ->{
if(HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())){
System.out.println(e.getURL());
Desktop desktop = Desktop.getDesktop();
try{
desktop.browse(e.getURL().toURI());
} catch(Exception ex){
ex.printStackTrace();
}
}
});
//format the pane
jobLink3.setPreferredSize(new Dimension(200,100));
jobLink3.setBorder(BorderFactory.createLineBorder(Color.CYAN, 5));
//add pane to the area
jobRecPanel.add(jobLink3);
//top rated companies panel with heading left justified
JPanel topCompPanel = new JPanel();
topCompPanel.setLayout(new GridLayout(2,3));
JLabel topCompanies = new JLabel("Some Companies on EmployAble");
JLabel thisBlank = new JLabel("");
JLabel thatBlank = new JLabel("");
JTextArea topCompany1 = new JTextArea(5, 20);
topCompany1.setEditable(false);//noneditable
//format area
topCompany1.setPreferredSize(new Dimension(200,5));
topCompany1.setBorder(BorderFactory.createLineBorder(Color.CYAN, 5));
StringBuffer company1 = new StringBuffer();
company1.append("Adobe");
company1.append("\nSeattle, WA");
//add text to the area
topCompany1.setText(company1.toString());
//second company
JTextArea topCompany2 = new JTextArea(5, 20);
topCompany2.setEditable(false);//noneditable
//format area
topCompany2.setPreferredSize(new Dimension(200,5));
topCompany2.setBorder(BorderFactory.createLineBorder(Color.CYAN, 5));
StringBuffer company2 = new StringBuffer();
company2.append("Google");
company2.append("\nNew York, NY");
//add text to the area
topCompany2.setText(company2.toString());
//thrid company
JTextArea topCompany3 = new JTextArea(5, 20);
topCompany3.setEditable(false); //noneditable
//format area
topCompany3.setPreferredSize(new Dimension(200,5));
topCompany3.setBorder(BorderFactory.createLineBorder(Color.CYAN, 5));
StringBuffer company3 = new StringBuffer();
company3.append("Coca-Cola");
company3.append("\nAtlanta, GA");
//add taxt to the area
topCompany3.setText(company3.toString());
//add the heading and the companies to the panel
topCompPanel.add(topCompanies);
topCompPanel.add(thisBlank);
topCompPanel.add(thatBlank);
topCompPanel.add(topCompany1);
topCompPanel.add(topCompany2);
topCompPanel.add(topCompany3);
//add all of the panels to the frame and with layout specifications
frame.getContentPane().add(BorderLayout.NORTH, panel);
frame.getContentPane().add(BorderLayout.WEST, jobRecPanel);
frame.getContentPane().add(BorderLayout.SOUTH, topCompPanel);
//make everything visible and pack frame
frame.setVisible(true);
frame.pack();
}
public static void main(String args[]){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JobSeekerHomeView().setVisible(true);
}
});
}
}