-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReception.java
More file actions
208 lines (177 loc) · 8.36 KB
/
Copy pathReception.java
File metadata and controls
208 lines (177 loc) · 8.36 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
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
package hospital.management.system;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Reception extends JFrame {
public Reception() {
setTitle("Filostack - Dashboard");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1280, 750);
setLocationRelativeTo(null);
setLayout(new BorderLayout());
// ===== HEADER =====
JPanel header = new JPanel(new BorderLayout()) {
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint gp = new GradientPaint(0, 0, new Color(21, 101, 192),
getWidth(), getHeight(), new Color(25, 118, 210));
g2d.setPaint(gp);
g2d.fillRect(0, 0, getWidth(), getHeight());
}
};
header.setPreferredSize(new Dimension(1280, 80));
header.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, new Color(13, 71, 161)));
JLabel title = new JLabel("Filostack Dashboard", JLabel.CENTER);
title.setFont(new Font("Segoe UI Semibold", Font.BOLD, 28));
title.setForeground(Color.WHITE);
header.add(title, BorderLayout.CENTER);
try {
ImageIcon icon = new ImageIcon(ClassLoader.getSystemResource("icons/hospital.png"));
Image scaled = icon.getImage().getScaledInstance(55, 55, Image.SCALE_SMOOTH);
JLabel logo = new JLabel(new ImageIcon(scaled));
logo.setBorder(BorderFactory.createEmptyBorder(10, 25, 10, 10));
header.add(logo, BorderLayout.WEST);
} catch (Exception ignore) {}
add(header, BorderLayout.NORTH);
// ===== SIDEBAR =====
JPanel sidebar = new JPanel() {
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
GradientPaint gp = new GradientPaint(0, 0, new Color(33, 150, 243),
0, getHeight(), new Color(13, 71, 161));
g2d.setPaint(gp);
g2d.fillRect(0, 0, getWidth(), getHeight());
}
};
sidebar.setPreferredSize(new Dimension(270, getHeight()));
sidebar.setLayout(new GridLayout(11, 1, 0, 10));
sidebar.setBorder(BorderFactory.createEmptyBorder(20, 15, 20, 15));
String[] btnNames = {
"Add New Patient", "Room", "Department", "All Employee Info",
"Patient Info", "Patient Discharge", "Update Patient Details",
"Hospital Ambulance", "Search Room", "Logout"
};
final JButton[] buttons = new JButton[btnNames.length];
final Color normalColor = new Color(25, 118, 210);
final Color hoverColor = new Color(13, 71, 161);
for (int i = 0; i < btnNames.length; i++) {
buttons[i] = new JButton(btnNames[i]);
buttons[i].setFont(new Font("Segoe UI", Font.BOLD, 15));
buttons[i].setForeground(Color.WHITE);
buttons[i].setFocusPainted(false);
buttons[i].setBackground(normalColor);
buttons[i].setOpaque(true);
buttons[i].setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(21, 101, 192), 1),
BorderFactory.createEmptyBorder(12, 20, 12, 20)
));
buttons[i].setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
final JButton b = buttons[i];
b.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent e) {
b.setBackground(hoverColor);
b.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(255, 255, 255, 150), 1),
BorderFactory.createEmptyBorder(12, 20, 12, 20)
));
}
public void mouseExited(MouseEvent e) {
b.setBackground(normalColor);
b.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(21, 101, 192), 1),
BorderFactory.createEmptyBorder(12, 20, 12, 20)
));
}
});
sidebar.add(buttons[i]);
}
add(sidebar, BorderLayout.WEST);
// ===== MAIN PANEL =====
JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.setBackground(Color.WHITE);
mainPanel.setBorder(BorderFactory.createEmptyBorder(40, 40, 40, 40));
JLabel welcome = new JLabel("<html><center>Welcome to <b>Hospital Management System</b><br><br>" +
"Use the navigation menu to access hospital modules,<br>" +
"manage patients, employees, rooms, and departments.<br><br>" +
"Your one-stop dashboard for hospital operations.</center></html>", JLabel.CENTER);
welcome.setFont(new Font("Segoe UI", Font.PLAIN, 20));
welcome.setForeground(new Color(70, 70, 70));
try {
ImageIcon banner = new ImageIcon(ClassLoader.getSystemResource("icons/dashboard_bg.png"));
Image img = banner.getImage().getScaledInstance(460, 300, Image.SCALE_SMOOTH);
JLabel imageLabel = new JLabel(new ImageIcon(img));
imageLabel.setHorizontalAlignment(JLabel.CENTER);
JPanel content = new JPanel(new BorderLayout());
content.setBackground(Color.WHITE);
content.add(welcome, BorderLayout.NORTH);
content.add(imageLabel, BorderLayout.CENTER);
mainPanel.add(content, BorderLayout.CENTER);
} catch (Exception e) {
mainPanel.add(welcome, BorderLayout.CENTER);
}
add(mainPanel, BorderLayout.CENTER);
// ===== BUTTON ACTIONS =====
buttons[0].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new NEW_PATIENT();
}
});
buttons[1].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Room();
}
});
buttons[2].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Department();
}
});
buttons[3].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Employee_info();
}
});
buttons[4].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ALL_Patient_Info();
}
});
buttons[5].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new PatientDischarge();
}
});
buttons[6].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new update_patient_details();
}
});
buttons[7].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Ambulance();
}
});
buttons[8].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new SearchRoom();
}
});
buttons[9].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int confirm = JOptionPane.showConfirmDialog(null,
"Are you sure you want to logout?",
"Logout Confirmation", JOptionPane.YES_NO_OPTION);
if (confirm == JOptionPane.YES_OPTION) {
setVisible(false);
new Login();
}
}
});
setVisible(true);
}
public static void main(String[] args) {
new Reception();
}
}