package xs;

/****************************************************************
*	Version		:	1.0
*	Date		:	02/03/2007
*	
*	Description
*	This is a Login frame of client side application in chat System.
*	It is used to just take the user name 
*	
*	Remarks
*	Before running the Login application make sure the server is running.
*	If server is running then only you can execute your application.
******************************************************************/


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;

// Login class which takes a user name and passed it to client class
public class Login implements ActionListener{
	JFrame frame1;
	JTextField tf;
	JButton button;
	JLabel heading;
	JLabel label;
	public static void main(String[] args){
		new Login();
	}
	public Login(){
		frame1 = new JFrame("Login Page");
		tf=new JTextField();
		button=new JButton("Login");
		heading=new JLabel("Chat Server");
		heading.setFont(new Font("Impact", Font.BOLD,40));
		label=new JLabel("Enter you Login Name");
		label.setFont(new Font("Serif", Font.PLAIN, 24));
		JPanel panel = new JPanel();
		button.addActionListener(this);
		panel.add(heading);panel.add(tf);panel.add(label);
		panel.add(button);
		heading.setBounds(30,20,280,80);
		label.setBounds(20,100,250,60);
		tf.setBounds(50,150,150,30);
		button.setBounds(70,200,90,30);
		frame1.add(panel);
		panel.setLayout(null);
		frame1.setSize(300, 300);
	    frame1.setVisible(true);
		frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	// pass the user name to MyClient class
	public void actionPerformed(ActionEvent e){
		String name="";
		try{
			name=tf.getText();
			frame1.dispose();
			MyClient mc=new MyClient(name);
		}catch (IOException te){}
	}
}
最近下载更多
794860639  LV1 2023年10月7日
caomin  LV4 2023年5月19日
kk1226  LV2 2022年12月30日
106sadadwd  LV2 2022年6月18日
Demo1111  LV30 2021年12月9日
胡萝北呀  LV3 2021年11月26日
顾北城  LV12 2021年11月21日
ComeDebug  LV6 2021年9月6日
Count count count  LV1 2021年7月9日
tyuthnw123  LV2 2021年6月22日
最近浏览更多
zeng1206  LV5 2023年12月28日
暂无贡献等级
794860639  LV1 2023年10月7日
KAIzx11  LV7 2023年6月25日
17683946472  LV9 2023年6月8日
caomin  LV4 2023年5月19日
微信网友_6444139264921600  LV6 2023年4月29日
青柠编程  LV13 2023年4月21日
内心向阳  LV4 2023年3月30日
臧家旺  LV3 2023年3月23日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友