-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDashboard.java
More file actions
181 lines (142 loc) · 5.15 KB
/
Copy pathDashboard.java
File metadata and controls
181 lines (142 loc) · 5.15 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
import java.awt.EventQueue;
import java.awt.Image;
//import java.awt.event.MouseListener;
//import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Color;
import javax.swing.border.LineBorder;
//import javax.swing.event.AncestorListener;
import javax.swing.event.MouseInputAdapter;
//import org.w3c.dom.events.MouseEvent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
//import javax.swing.JOptionPane;
//import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Dashboard extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Dashboard frame = new Dashboard();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public Dashboard() {
setBackground(Color.CYAN);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 790, 487);
contentPane = new JPanel();
contentPane.setBackground(Color.CYAN);
setUndecorated(true);
contentPane.setBorder(new LineBorder(Color.GREEN, 2));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBackground(new Color(0, 191, 255));
panel.setBounds(0, 0, 297, 487);
contentPane.add(panel);
panel.setLayout(null);
JLabel lblNewLabel = new JLabel("");
Image img = new ImageIcon(this.getClass().getResource("menuIcon.png")).getImage();
lblNewLabel.setIcon(new ImageIcon(img));
lblNewLabel.setBounds(-30, 30, 352, 99);
panel.add(lblNewLabel);
JButton btnNewButton = new JButton("Exit");
btnNewButton.addMouseListener(new ButtonHandler(btnNewButton));
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFrame frame = new JFrame("EXIT");
if(JOptionPane.showConfirmDialog(frame,"Confirm if you want to EXIT", "EXIT",
JOptionPane.YES_NO_CANCEL_OPTION)==JOptionPane.YES_NO_OPTION) {
System.exit(0);
}
}
});
btnNewButton.setBounds(0, 415, 297, 61);
panel.add(btnNewButton);
btnNewButton.setForeground(new Color(0, 0, 0));
btnNewButton.setBackground(new Color(0, 206, 209));
btnNewButton.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
JButton btnNewButton_1 = new JButton("Shop");
btnNewButton_1.setForeground(Color.BLACK);
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Shop shop_frame = new Shop();
shop_frame.setVisible(true);
dispose();
}
});
btnNewButton_1.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
btnNewButton_1.setBackground(new Color(0, 206, 209));
btnNewButton_1.addMouseListener(new ButtonHandler(btnNewButton_1));
btnNewButton_1.setBounds(0, 140, 297, 61);
panel.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("Cos");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Cos cos_frame = new Cos();
cos_frame.setVisible(true);
dispose();
}
});
btnNewButton_2.setForeground(Color.BLACK);
btnNewButton_2.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
btnNewButton_2.setBackground(new Color(0, 206, 209));
btnNewButton_2.addMouseListener(new ButtonHandler(btnNewButton_2));
btnNewButton_2.setBounds(0, 202, 297, 61);
panel.add(btnNewButton_2);
JButton btnNewButton_3 = new JButton("LogIn");
btnNewButton_3.setForeground(Color.BLACK);
btnNewButton_3.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
btnNewButton_3.setBackground(new Color(0, 206, 209));
btnNewButton_3.setBounds(0, 267, 297, 61);
panel.add(btnNewButton_3);
btnNewButton_3.addMouseListener(new ButtonHandler(btnNewButton_3));
JLabel lblNewLabel_1 = new JLabel("");
lblNewLabel_1.setBounds(283, 0, 497, 450);
contentPane.add(lblNewLabel_1);
Image img1 = new ImageIcon(this.getClass().getResource("4470054.png")).getImage();
lblNewLabel_1.setIcon(new ImageIcon(img1));
btnNewButton_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
LogInPanel panel2 = new LogInPanel();
panel2.setVisible(true);
dispose();
}
});
}
private class ButtonHandler extends MouseInputAdapter {
JButton b;
public ButtonHandler(JButton b) {
this.b = b;
}
@Override
public void mouseEntered(java.awt.event.MouseEvent e) {
b.setBackground(new Color(112, 128, 144));
}
@Override
public void mouseExited(java.awt.event.MouseEvent e) {
b.setBackground(new Color(0, 206, 209));
}
@Override
public void mousePressed(java.awt.event.MouseEvent e) {
b.setBackground(new Color(60, 179, 113));
}
@Override
public void mouseReleased(java.awt.event.MouseEvent e) {
b.setBackground(new Color(112, 128, 144));
}
}
}