import java
import java
import java
import java
import java
import java
import
import
import
import
import
import javax
import javax
public class netchat {
JFrame jf=new JFrame(
List l=new List(
JPanel jp=new JPanel();
TextField tip=new TextField(
TextField tdata=new TextField(
DatagramSocket ds;
//DatagramPacket dp;
public netchat()
{
tip
try {
ds=new DatagramSocket(
} catch (SocketException e) {
// TODO Auto
e
}
new Thread(new Runnable()
{
DatagramPacket dp;
public void run()
{
byte [] buf=new byte[
dp=new DatagramPacket(buf
//
// byte[] buf=new byte[
// dp=new DatagramPacket(buf
while(true)
{
try {
ds
// l
l
} catch (IOException e) {
// TODO Auto
e
}
}
}
})
}
public static void main(String[] args) {
// TODO Auto
new netchat()
}
private void init()
{
jf
jp
jp
jf
jf
jf
jf
tdata
{
public void actionPerformed(ActionEvent e)
{
// byte[] buf;
// buf=e
// DatagramPacket dp;
// try
// {
// dp=new DatagramPacket(buf
// ds
//
byte [] buf;
buf=e
DatagramPacket dp;
try {
dp= new DatagramPacket(buf
ds
} catch (UnknownHostException e
// TODO Auto
e
} catch (IOException e
// TODO Auto
e
}
((TextField)e
}
});
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25988.html