JAVA聊天室哪里有错误!!

来源:百度知道 编辑:UC知道 时间:2024/05/08 08:48:28
/*
* @(#)Lts.java 1.0 04/10/26
*
* You can modify the template of this file in the
* directory ..\JCreator\Templates\Template_1\Project_Name.java
*
* You can also create your own project template by making a new
* folder in the directory ..\JCreator\Template\. Use the other
* templates as examples.
*
*/
package myprojects.lts;
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;

class Lts implements Runnable
{

public static void main(String args[]) {
Thread th=new Thread(new Send());//这里有错误
th.start();

}
public void run()
{
try {
Socket sc=null;
ServerSocket ser=new ServerSocket(8001);
while(true)
{
sc=ser.accept();
DataInputStream in =new DataInputStream(new BufferedInputStream(sc.getInputStream()));//这里不知道完不完

import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;

public class lts extends Frame implements ActionListener {

Button b1 = new Button("发送");
Button b2 = new Button("取消");

TextArea tal = new TextArea(10, 70);
TextField t1 = new TextField("", 30);
TextField t2 = new TextField("", 10);

lts() {
setSize(520, 250);
setBackground(Color.blue);
setTitle("聊天室");
Panel p1 = new Panel();
this.add(p1);
p1.add(tal);
p1.add(new Label("IP:"));
p1.add(t2);
p1.add(new Label("发言:"));
p1.add(t1);
b1.addActionListener(this);
p1.add(b1);
b2.addActionListener(this);
p1.add(b2);
setVisible(true);
Thread th = new Thread(new Lts());
th.start();
}

class Lts implements Runnable {

public