-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewApplications.java
More file actions
143 lines (106 loc) · 6.25 KB
/
ViewApplications.java
File metadata and controls
143 lines (106 loc) · 6.25 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
package com.mycompany.viewapplication;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import javax.swing.table.DefaultTableCellRenderer;
public class ViewApplication {
public static void main(String[] args) {
SwingUtilities.invokeLater(ViewApplication::createAndShowGUI);
}
private static void createAndShowGUI() {
// Main frame
JFrame frame = new JFrame("Job Application Tracker");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1000, 700);
frame.setLayout(new BorderLayout());
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.setBackground(new Color(70, 130, 180)); // Steel Blue
JLabel headerLabel = new JLabel("View Applications");
headerLabel.setFont(new Font("Serif", Font.BOLD, 36));
headerLabel.setForeground(Color.WHITE);
headerLabel.setHorizontalAlignment(SwingConstants.CENTER);
headerPanel.add(headerLabel, BorderLayout.CENTER);
JLabel profileLabel = new JLabel();
ImageIcon profileIcon = new ImageIcon("C:/Users/gameo/Downloads/4092564_profile_about_mobile ui_user_icon.png");
Image img = profileIcon.getImage().getScaledInstance(40, 40, Image.SCALE_SMOOTH); // Resize to 40x40
profileLabel.setIcon(new ImageIcon(img));
headerPanel.add(profileLabel, BorderLayout.EAST);
frame.add(headerPanel, BorderLayout.NORTH);
String[] columnNames = {
"Company Name", "Job Title", "Application Date", "Status",
"Location", "Salary Range", "Follow-Up Date", "Notes"
};
Object[][] data = {
{"ABC Corp", "Software Engineer", "2025-10-01", "Interview Scheduled", "Remote", "$80,000 - $100,000", "2025-10-15", "Great fit!"},
{"XYZ Inc", "Data Analyst", "2025-09-25", "Rejected", "On-site", "$70,000 - $90,000", "N/A", "Follow up next time"},
{"TechGenius", "Backend Developer", "2025-11-01", "Application Submitted", "Hybrid", "$95,000 - $120,000", "2025-11-10", "Requires Java experience."},
{"SoftServe", "Product Manager", "2025-10-20", "Interview Scheduled", "Remote", "$100,000 - $130,000", "2025-10-30", "Exciting opportunity!"},
{"FinTech Solutions", "Financial Analyst", "2025-09-15", "Offer Received", "On-site", "$85,000 - $105,000", "2025-09-25", "Negotiated salary."},
{"DreamWorks", "UI/UX Designer", "2025-08-30", "Rejected", "Remote", "$75,000 - $95,000", "N/A", "Portfolio feedback was positive."},
{"CodeNation", "Full Stack Developer", "2025-11-15", "Application Submitted", "Hybrid", "$110,000 - $140,000", "2025-11-25", "Strong React/Node.js skills required."},
{"DataMinds", "Data Scientist", "2025-10-05", "Interview Scheduled", "Remote", "$120,000 - $150,000", "2025-10-18", "Focus on machine learning."},
{"HealthCare Inc", "Business Analyst", "2025-09-01", "Offer Declined", "On-site", "$70,000 - $90,000", "2025-09-10", "Role not aligned with career goals."}
};
DefaultTableModel tableModel = new DefaultTableModel(data, columnNames);
JTable table = new JTable(tableModel);
table.setRowHeight(25);
DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer();
headerRenderer.setFont(new Font("Serif", Font.BOLD, 18)); // Unique font style and size for column headers
headerRenderer.setBackground(new Color(200, 200, 200)); // Light gray background for headers
headerRenderer.setHorizontalAlignment(SwingConstants.CENTER);
for (int i = 0; i < table.getColumnCount(); i++) {
table.getColumnModel().getColumn(i).setHeaderRenderer(headerRenderer);
}
JScrollPane scrollPane = new JScrollPane(table);
JPanel buttonPanel = new JPanel();
JButton addButton = new JButton("Add");
JButton editButton = new JButton("Edit");
JButton deleteButton = new JButton("Delete");
buttonPanel.add(addButton);
buttonPanel.add(editButton);
buttonPanel.add(deleteButton);
addButton.addActionListener(e -> addRow(tableModel));
editButton.addActionListener(e -> editRow(table, tableModel));
deleteButton.addActionListener(e -> deleteRow(table, tableModel));
JPanel footerPanel = new JPanel();
footerPanel.setBackground(new Color(70, 130, 180)); // Steel Blue
JLabel footerLabel = new JLabel("© 2025 Job Application Tracker. All Rights Reserved.", JLabel.CENTER);
footerLabel.setFont(new Font("Serif", Font.PLAIN, 14));
footerLabel.setForeground(Color.WHITE);
footerPanel.add(footerLabel);
JPanel bottomPanel = new JPanel(new BorderLayout());
bottomPanel.add(buttonPanel, BorderLayout.NORTH);
bottomPanel.add(footerPanel, BorderLayout.SOUTH);
frame.add(scrollPane, BorderLayout.CENTER);
frame.add(bottomPanel, BorderLayout.SOUTH);
frame.setVisible(true);
}
private static void addRow(DefaultTableModel tableModel) {
tableModel.addRow(new Object[]{"", "", "", "", "", "", "", ""});
}
private static void editRow(JTable table, DefaultTableModel tableModel) {
int selectedRow = table.getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(table, "Please select a row to edit.");
return;
}
for (int i = 0; i < tableModel.getColumnCount(); i++) {
String newValue = JOptionPane.showInputDialog(
table, "Edit value for " + tableModel.getColumnName(i),
tableModel.getValueAt(selectedRow, i)
);
if (newValue != null) {
tableModel.setValueAt(newValue, selectedRow, i);
}
}
}
private static void deleteRow(JTable table, DefaultTableModel tableModel) {
int selectedRow = table.getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(table, "Please select a row to delete.");
return;
}
tableModel.removeRow(selectedRow);
}
}