-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginView.java
89 lines (74 loc) · 2.76 KB
/
LoginView.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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class LoginView extends JFrame //implements ActionListener
{
Container contentPane;
LoginController controller;
LoginView()
{
contentPane=this.getContentPane();
JPanel loginpanel = new JPanel();
setBounds(0,0,350,600);
this.setVisible(true);
this.setLayout( null);
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
JLabel label1 = new JLabel("ID : ");
JLabel label2 = new JLabel("PW : ");
JTextField text1 = new JTextField(10);
JPasswordField text2 = new JPasswordField(10);
JRadioButton checkAudience = new JRadioButton("Audience",false);
JRadioButton checkHost = new JRadioButton("Host",false);
ButtonGroup btngroup = new ButtonGroup();
JButton login = new JButton("로그인");
btngroup.add(checkAudience);
btngroup.add(checkHost);
label1.setBounds(50, 170, 50, 30);
label2.setBounds(50, 200, 50, 30);
text1.setBounds(110, 170, 150, 30);
text2.setBounds(110, 200, 150, 30);
checkAudience.setBounds(50, 250,90, 30);
checkHost.setBounds(180, 250,90, 30);
login.setBounds(100, 280, 80, 30);
label1.setFont(new java.awt.Font("Gulim", 0, 14));
label2.setFont(new java.awt.Font("Gulim", 0, 14));
text1.setFont(new java.awt.Font("Gulim", 0, 14));
text2.setFont(new java.awt.Font("Gulim", 0, 14));
checkAudience.setFont(new java.awt.Font("Gulim", 0, 14));
checkHost.setFont(new java.awt.Font("Gulim", 0, 14));
login.setFont(new java.awt.Font("Gulim", 0, 14));
loginpanel.add(label1);
loginpanel.add(label2);
loginpanel.add(text1);
loginpanel.add(text2);
loginpanel.add(checkAudience);
loginpanel.add(checkHost);
loginpanel.add(login);
login.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e) {
int checknumber;
if(checkAudience.isSelected())
checknumber=1;
else if(checkHost.isSelected())
checknumber=2;
else
checknumber=0;
controller = new LoginController(text1.getText(),text2.getText(),checknumber);//input user information.
controller.checkLogin();
dispose();
}
});
// frame setting
loginpanel.setVisible(true);
loginpanel.setLayout(null);
setSize(350,600);
this.setContentPane(loginpanel);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String arr[])
{
new LoginView();
}
}