-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguitry.java
More file actions
66 lines (45 loc) · 1.38 KB
/
guitry.java
File metadata and controls
66 lines (45 loc) · 1.38 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class guitry implements ActionListener {
private static JLabel userLabel,passLabel,success;
private static JPanel panel;
private static JButton but;
private static JPasswordField passText;
private static JTextField userText;
public static void main(String[] args) {
JFrame frame=new JFrame("first");
frame.setSize(350,100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel=new JPanel();
frame.add(panel);
panel.setLayout(null);
userLabel = new JLabel("User");
userLabel.setBounds(50,20,80,25);
panel.add(userLabel);
userText=new JTextField(20);
userText.setBounds(100,20,165,25);
panel.add(userText);
passLabel = new JLabel("Password");
passLabel.setBounds(50,50,80,25);
panel.add(passLabel);
passText = new JPasswordField();
passText.setBounds(100,50,80,25);
panel.add(passText);
but=new JButton("Login");
but.setBounds(50,80,80,25);
but.addActionListener(new guitry());
panel.add(but);
success = new JLabel("");
success.setBounds(10,110,300,25);
panel.add(success);
frame.setVisible(true);
//panel.setlayout(new Gridlayout);
}
@Override
public void actionPerformed(ActionEvent e){
String user =userText.getText();
String password=passText.getText();
System.out.println(user+" "+password);
}
}