-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.java
More file actions
150 lines (106 loc) · 3.11 KB
/
admin.java
File metadata and controls
150 lines (106 loc) · 3.11 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
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Date;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class admin extends JFrame
implements ActionListener
{
JTextField tf1;
JPasswordField pf1;
JLabel l1,l2,l3;
JButton b1;
public void adminUI()
{
super.setBounds(400, 100, 500, 500);
super.setTitle("ADMIN LOGIN");
super.setResizable(false);
// JFrame COLOR
setLayout(new BorderLayout());
setContentPane(new JLabel(new ImageIcon
("E:\\eclipse-workspace\\BANKING\\wallpaper\\placed\\bg4final.jpg")));
setLayout(new FlowLayout());
//..
// label
//Font f2=new Font("",Font.BOLD,15);
l1 = new JLabel("ADMIN EMAIL: ");
l1.setBounds(40, 40, 300, 50);
super.add(l1);
l1.setForeground(Color.white);
//l1.setFont(f2);
l2 = new JLabel("ADMIN PASSWORD: ");
l2.setBounds(40, 120, 300, 50);
super.add(l2);
l2.setForeground(Color.white);
//l2.setFont(f2);
tf1 =new JTextField();
tf1.setBounds(250, 50, 200, 35);
super.add(tf1);
tf1.setBackground(Color.black);
tf1.setForeground(Color.orange);
// pass field
pf1 = new JPasswordField();
pf1.setBounds(250, 130, 200, 35);
super.add(pf1);
pf1.setBackground(Color.black);
pf1.setForeground(Color.orange);
// button
b1=new JButton("LOGIN");
b1.setBounds(170, 270, 150, 40);
super.add(b1);
b1.setBackground(Color.black);
b1.setForeground(Color.green);
b1.addActionListener(this);
// 3rd last
super.setLayout(null);
// 2nd last
super.setVisible(true);
//last st
super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
String adNAME = tf1.getText();
char[] adpass1 = pf1.getPassword();
String adPASS = String.copyValueOf(adpass1);
// check authentication
String adCNAME = "admin@admin.com";
String adCPASS = "admin";
if(adNAME.equalsIgnoreCase(adCNAME) && adCPASS.equalsIgnoreCase(adCPASS))
{
admin2 run93 = new admin2();
run93.adminUI2();
super.dispose();
}
else
{
JOptionPane.showMessageDialog(this, "ADMIN EMAIL OR PASS IS INCORRECT !");
}
}
}
public static void main(String[] args)
{
admin run91 = new admin();
run91.adminUI();
}
}