-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintro.java
More file actions
113 lines (94 loc) · 2.48 KB
/
Copy pathintro.java
File metadata and controls
113 lines (94 loc) · 2.48 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.text.*;
public class intro extends JFrame
{
Container c=getContentPane();
JPanel Header= new JPanel();
JPanel PLogin = new JPanel(null);
JLabel LAirline= new JLabel("<html><B><h1><center>Airline</center><br><center> Reservation<center><br><center>System<center</h1></B></html>");
JLabel LUserName, LPassword;
JTextField TFUserName;
JPasswordField TPPassword;
JButton BLogin;
public intro()
{
//WindowUtilities.setNativeLookAndFeel();
setPreferredSize(new Dimension(796,572));
PLogin.setBackground(Color.white);
Header.setBackground(Color.white);
Header.setBounds(0,0,600, 200);
PLogin.setBounds(0,200,600, 400);
LUserName = new JLabel(" User Name ");
LPassword = new JLabel(" Password ");
TFUserName = new JTextField(18);
TPPassword = new JPasswordField(18);
BLogin = new JButton("Sign In");
LAirline.setBounds(150,75,450,175);
LUserName.setBounds(200, 100, 100, 30);
LPassword.setBounds(200, 170, 100, 30);
TFUserName.setBounds(400, 100, 100, 30);
TPPassword.setBounds(400, 170, 100, 30);
BLogin.setBounds(300, 240, 100,30);
c.add(PLogin);
c.add(Header);
PLogin.add(LUserName);
PLogin.add(TFUserName);
PLogin.add(LPassword);
PLogin.add(TPPassword);
PLogin.add(BLogin);
Header.add(LAirline);
pack();
setVisible(true);
BLogin.addActionListener(new button5(this));
}
public static void main(String args[])
{
new intro();
}
}
class button5 implements ActionListener
{
intro type;
char[] cCheck, cPassword={'d','e','m','o','\0'};
JFrame f;
String sCheck,sCheck1="demo";
public button5(intro type)
{
this.type = type;
}
public void actionPerformed(ActionEvent e)
{
cCheck=type.TPPassword.getPassword();
sCheck = type.TFUserName.getText();
if ((sCheck1.equals(sCheck)) && check())
{
/*type.PLogin.add(type.LDomesticFlight1);
type.PLogin.add(type.LInternationalFlight1);
type.PLogin.remove(type.LUserName);
type.PLogin.remove(type.TFUserName);
type.PLogin.remove(type.LPassword);
type.PLogin.remove(type.TPPassword);
type.PLogin.remove(type.BLogin);
type.c.repaint();*/
//new DomesticFlight();
new airline();
}
else
{
JOptionPane.showMessageDialog(null, "Invalid username or password. Try again");
}
}
public boolean check()
{
if (cCheck.length >= 5 || cCheck.length < 4)
return false;
for(int i=0;i<4;i++)
{
if(cCheck[i]!=cPassword[i])
return false;
}
return true;
}
}