-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWelcome.java
136 lines (89 loc) · 3.28 KB
/
Welcome.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
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Welcome extends JFrame {
private Container c;
private ImageIcon icon, logo, welcome;
private JLabel imgLabel;
private Font f1;
private JButton btn1, btn2, btn3, nBtn;
private Cursor cursor;
Welcome() {
// Frame Layout
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("Rent Management");
this.setSize(900, 450);
this.setLocationRelativeTo(null);
this.setResizable(false);
c = this.getContentPane();
c.setLayout(null);
c.setBackground(Color.decode("#F2F2F2"));
// Icon
icon = new ImageIcon(getClass().getResource("/images/icon.png"));
this.setIconImage(icon.getImage());
// Logo and Images
logo = new ImageIcon(getClass().getResource("/images/Logo.jpg"));
imgLabel = new JLabel(logo);
imgLabel.setBounds(10, 10, logo.getIconWidth(), logo.getIconHeight());
c.add(imgLabel);
welcome = new ImageIcon(getClass().getResource("/images/Welcome.png"));
imgLabel = new JLabel(welcome);
imgLabel.setBounds(440, 70, welcome.getIconWidth(), welcome.getIconHeight());
c.add(imgLabel);
// Fonts
f1 = new Font("Segoe UI Black", Font.BOLD, 25);
// Cursor for JButtons
cursor = new Cursor(Cursor.HAND_CURSOR);
// JButtons
btn1 = new JButton("Exit");
btn1.setBounds(90, 325, 200, 50);
btn1.setFont(f1);
btn1.setCursor(cursor);
btn1.setForeground(Color.WHITE);
btn1.setBackground(Color.decode("#C00000"));
c.add(btn1);
btn2 = new JButton("About us");
btn2.setBounds(325, 325, 245, 50);
btn2.setFont(f1);
btn2.setCursor(cursor);
btn2.setForeground(Color.WHITE);
btn2.setBackground(Color.decode("#226135"));
c.add(btn2);
btn3 = new JButton("Next");
btn3.setBounds(605, 325, 200, 50);
btn3.setFont(f1);
btn3.setCursor(cursor);
btn3.setForeground(Color.WHITE);
btn3.setBackground(Color.decode("#226135"));
c.add(btn3);
nBtn = new JButton("");
nBtn.setBounds(0, 0, 0, 0);
c.add(nBtn);
// Action Listener for JButtons
// Exit Button
btn1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
System.exit(0);
}
});
// Aboutus Button
btn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
AboutUS frame = new AboutUS();
frame.setVisible(true);
}
});
// Next Button
btn3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
setVisible(false);
Home frame = new Home();
frame.setVisible(true);
}
});
}
public static void main(String[] args) {
Welcome frame = new Welcome();
frame.setVisible(true);
}
}