-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWelcomePanel.java
More file actions
159 lines (128 loc) · 5.8 KB
/
Copy pathWelcomePanel.java
File metadata and controls
159 lines (128 loc) · 5.8 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
package banking.panels;
import javax.swing.*;
import java.awt.*;
import banking.BankingGUI;
import banking.StyledComponents;
public class WelcomePanel extends JPanel {
public WelcomePanel(BankingGUI app) {
setLayout(new BorderLayout(0, 0));
setBackground(BankingGUI.BACKGROUND);
// Gradient Header
JPanel headerPanel = StyledComponents.createGradientPanel(
new Color(79, 70, 229),
new Color(147, 51, 234)
);
headerPanel.setPreferredSize(new Dimension(750, 200));
headerPanel.setLayout(new GridBagLayout());
JPanel headerContent = new JPanel();
headerContent.setOpaque(false);
headerContent.setLayout(new BoxLayout(headerContent, BoxLayout.Y_AXIS));
JLabel emoji = new JLabel("🏦", SwingConstants.CENTER);
emoji.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 60));
emoji.setAlignmentX(Component.CENTER_ALIGNMENT);
JLabel title = new JLabel("Bank Management System");
title.setFont(new Font("Segoe UI", Font.BOLD, 38));
title.setForeground(Color.WHITE);
title.setAlignmentX(Component.CENTER_ALIGNMENT);
JLabel subtitle = new JLabel("Secure • Fast • Modern Banking");
subtitle.setFont(new Font("Segoe UI", Font.PLAIN, 16));
subtitle.setForeground(new Color(224, 231, 255));
subtitle.setAlignmentX(Component.CENTER_ALIGNMENT);
headerContent.add(emoji);
headerContent.add(Box.createVerticalStrut(10));
headerContent.add(title);
headerContent.add(Box.createVerticalStrut(10));
headerContent.add(subtitle);
headerPanel.add(headerContent);
// Center Panel with Cards
JPanel centerPanel = new JPanel();
centerPanel.setBackground(BankingGUI.BACKGROUND);
centerPanel.setLayout(new GridBagLayout());
centerPanel.setBorder(BorderFactory.createEmptyBorder(40, 40, 40, 40));
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(15, 15, 15, 15);
gbc.fill = GridBagConstraints.HORIZONTAL;
// Login Card
JPanel loginCard = createActionCard(
"🔐",
"Login to Account",
"Access your existing account",
new Color(79, 70, 229)
);
// Signup Card
JPanel signupCard = createActionCard(
"✨",
"Create New Account",
"Join us today",
new Color(16, 185, 129)
);
loginCard.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
app.showPanel(BankingGUI.LOGIN_PANEL);
}
});
signupCard.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
app.showPanel(BankingGUI.SIGNUP_PANEL);
}
});
gbc.gridy = 0;
centerPanel.add(loginCard, gbc);
gbc.gridy = 1;
centerPanel.add(signupCard, gbc);
add(headerPanel, BorderLayout.NORTH);
add(centerPanel, BorderLayout.CENTER);
}
private JPanel createActionCard(String emoji, String title, String subtitle, Color accentColor) {
JPanel card = new JPanel();
card.setLayout(new BorderLayout(15, 15));
card.setBackground(BankingGUI.CARD_BG);
card.setPreferredSize(new Dimension(400, 100));
card.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(55, 65, 81), 2),
BorderFactory.createEmptyBorder(20, 25, 20, 25)
));
card.setCursor(new Cursor(Cursor.HAND_CURSOR));
// Emoji
JLabel emojiLabel = new JLabel(emoji);
emojiLabel.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 40));
// Text Panel
JPanel textPanel = new JPanel();
textPanel.setOpaque(false);
textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS));
JLabel titleLabel = new JLabel(title);
titleLabel.setFont(new Font("Segoe UI", Font.BOLD, 18));
titleLabel.setForeground(Color.WHITE);
JLabel subtitleLabel = new JLabel(subtitle);
subtitleLabel.setFont(new Font("Segoe UI", Font.PLAIN, 13));
subtitleLabel.setForeground(new Color(156, 163, 175));
textPanel.add(titleLabel);
textPanel.add(Box.createVerticalStrut(5));
textPanel.add(subtitleLabel);
// Arrow
JLabel arrow = new JLabel("→");
arrow.setFont(new Font("Segoe UI", Font.BOLD, 30));
arrow.setForeground(accentColor);
card.add(emojiLabel, BorderLayout.WEST);
card.add(textPanel, BorderLayout.CENTER);
card.add(arrow, BorderLayout.EAST);
// Hover effect
card.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
card.setBackground(new Color(55, 65, 81));
card.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(accentColor, 2),
BorderFactory.createEmptyBorder(20, 25, 20, 25)
));
}
public void mouseExited(java.awt.event.MouseEvent evt) {
card.setBackground(BankingGUI.CARD_BG);
card.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(55, 65, 81), 2),
BorderFactory.createEmptyBorder(20, 25, 20, 25)
));
}
});
return card;
}
}