public static void main(String[] args) throws SocketException {
// TODO Auto-generated method stub
Frame f=new Frame("Talk to NoOne");
f.setBounds(400,150,600,400);
f.setLayout(new FlowLayout());
Button b=new Button("发送");
TextArea ta=new TextArea();
TextArea tp=new TextArea();
f.add(tp,"LEFT");
f.add(ta,"LEFT");
f.add(b,"TRAILING");
//final DatagramSocket receive;
f.setVisible(true);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
tp.setText("");//就是这里o,换成别的就可以
ta.setText("");
}
});
}
|
|