importjava.awt.Button;
importjava.awt.Frame;
importjava.awt.TextArea;
importjava.awt.TextField;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.awt.event.WindowAdapter;
importjava.awt.event.WindowEvent;
publicclassyingextendsFrame{
//定义在外面
TextAreata;
TextFieldtf;
publicying(){//用构造函数初始化
ta=newTextArea(\"\");
ta.setBounds(50,50,350,200);
tf=newTextField(\"\");
tf.setBounds(50,300,350,50);
Buttonb1=newButton(\"发送\");
b1.setBounds(400,300,50,50);
Buttonb2=newButton(\"关闭\");
b2.setBounds(460,300,50,50);
add(ta);
add(tf);
add(b1);
add(b2);
//shuyi=newshu();
b1.addActionListener(newActionListener(){
@Override
publicvoidactionPerformed(ActionEvente){
//TODOAuto-generatedmethodstub
ta.append(tf.getText()\"\\n\");
tf.setText(\"\");
}
});
jieer=newjie();
b2.addActionListener(er);
addWindowListener(newWindowAdapter(){
publicvoidwindowClosing(WindowEventee){
System.exit(0);
}
});
}
publicstaticvoidmain(String[]args){
// Framef=newFrame(\"QQ\");
yingf=newying();
f.setLayout(null);
f.setTitle(\"QQ\");
f.setSize(600,600);
f.setVisible(true);
}
classjieimplementsActionListener{
publicvoidactionPerformed(ActionEvente){
System.exit(0);//不是1
}
}
}
你的重新布局一下
<h4class=\"ask\">追问
能把你的qq给我吗,给你追分,你真是高手啊!!我的是471530693, |