-
Notifications
You must be signed in to change notification settings - Fork 3
/
userbtn.java
51 lines (47 loc) · 1.38 KB
/
userbtn.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
package bus_booking;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class userbtn extends JFrame implements ActionListener{
JButton addBtn, modifyBtn,exitbtn;
TextField text = new TextField(20);
userbtn(){
setTitle("User");
getContentPane().setBackground(Color.ORANGE);
setBackground(Color.CYAN);
getContentPane().setForeground(Color.WHITE);
getContentPane().setLayout(new FlowLayout());
JLabel label = new JLabel("User");
label.setFont(new Font("Times New Roman", Font.BOLD, 20));
label.setForeground(Color.BLUE);
getContentPane().add(label);
setBounds(600, 200, 600, 600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addBtn = new JButton("Add new User ");
addBtn.addActionListener(this);
modifyBtn = new JButton("Change password");
modifyBtn.addActionListener(this);
exitbtn = new JButton("Exit");
exitbtn.addActionListener(this);
add(addBtn);
add(modifyBtn);
add(exitbtn);
setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == addBtn) {
user obj1=new user("user111","pass111");
obj1.addDetails();
repaint();
}
else if (ae.getSource() == modifyBtn) {
user obj1=new user("user111","pass111");
obj1.modifyDetails("newpass111");
repaint();
}
else if (ae.getSource() == exitbtn) {
Runtime.getRuntime().exit(1);
repaint();
}
}
}