package chat;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Login extends JFrame implements ActionListener{
JFrame jf=new JFrame("login");
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JLabel l1=new JLabel("����������dzƣ�");
JLabel l2=new JLabel("�����÷�����ĵ�ַ");
JTextField t1=new JTextField();
JTextField t2=new JTextField();
JButton loginButton=new JButton("login");
public Login()
{
p1.setLayout(new GridLayout(2,3));
p1.add(l1);
p1.add(t1);
p1.add(l2);
p1.add(l2);
p2.setLayout(new FlowLayout());
p2.add(loginButton);
jf.getContentPane().add(p1,"north");
jf.getContentPane().add(p2);
jf.pack();
jf.setLocation(200,300);
jf.setVisible(true);
t1.addActionListener(this);
t2.addActionListener(this);
loginButton.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{ if(!t1.getText().equals("")&&!t2.getText().equals(""))
{
TestCilent c=new TestCilent(t1.getText(),t2.getText());
jf.setVisible(false);
}
}
public static void main(String[] args)
{
Login aa=new Login();
}
}
阅读(2750) | 评论(0) | 转发(0) |