⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.java

📁 java语音聊天系统 分为服务器端 客户端 连接之后 既可以相互通信 包括语音 摄像头
💻 JAVA
字号:
package PC;

import java.io.*; 
import java.net.*; 
import java.awt.*; 
import javax.swing.*; 
import javax.swing.border.TitledBorder;
import java.awt.event.*; 

public class Login extends JFrame 
{
	private JLabel logo;
	private JLabel serverip;
	private JLabel serverport;
	private JLabel name;
	private JButton request;
	private JTextField sip;
	private JTextField nametext;
	private JTextField sport;
	public Login()
	{
		Frame t = this;
		t.setSize(480, 385);
		setLayout(null);
		setBackground(Color.white);
		ImageIcon icon1 = new ImageIcon("lang1.jpg");
		logo = new JLabel(icon1);
		serverip = new JLabel("SERVER  IP");
		serverport = new JLabel("SERVERPORT");
		name = new JLabel("YOU  NAME");
		sip=new JTextField();
		sport=new JTextField();
		nametext=new JTextField();
		request=new JButton("REQUEST CONNECTION");
		logo.setSize(150, 100);
		logo.setLocation(20, 100);
		serverip.setSize(80, 20);
		serverip.setLocation(170, 100);
		serverport.setSize(80, 20);
		serverport.setLocation(170, 120);	
		name.setSize(80, 20);
		name.setLocation(170, 140);	
		sip.setSize(100, 20);
		sip.setLocation(250, 100);	
		sport.setSize(100, 20);
		sport.setLocation(250, 120);
		nametext.setSize(100, 20);
		nametext.setLocation(250, 140);
		request.setSize(180, 20);
		request.setLocation(170, 180);
		add(logo);
		add(sip);
		add(serverip);
		add(sport);
		add(serverport);
		add(request);
		add(name);
		add(nametext);
		request.addActionListener(new Request(t));
		addWindowListener
		(
			new WindowAdapter()
			{ 
			    public void windowClosing(WindowEvent e)
			    { 
				    System.exit(0); 
			    } 
			}
	   ); 
	}
	public static void main(String args[])
	{ 
		Login chat = new Login(); 
		chat.show(); 
	}
	public class Request implements ActionListener {
		Frame t; 
		Request(){} 
		Request(Frame t){ 
		this.t = t; 
		} 
		public void actionPerformed(ActionEvent event) 
		{
			String a="192.168.0.242";
			String b="6668";
			String c=nametext.getText();
			t.setVisible(false); 
			Friends friend=new Friends(a,b,c);
			friend.show(); 
	    }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -