用eclipse编写的frame窗口关不掉
在eclipse里面运行关不了,在命令提示符窗口下运行也关不了,JDK版本是1.7.0的。importjava.awt.*;importjava.awt.event.*;...
在eclipse里面运行关不了,在命令提示符窗口下运行也关不了,JDK版本是1.7.0的。
import java.awt.*;
import java.awt.event.*;
public class ChatClient extends Frame{
TextField tf=new TextField();
TextArea ta=new TextArea();
public static void main(String[] args) {
new ChatClient().launch();
}
public void launch(){
setLocation(300,300);
setSize(400,400);
add(tf,BorderLayout.SOUTH);
add(ta,BorderLayout.NORTH);
pack();
setResizable(true);
this.addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent e){
setVisible(false);
System.exit(0);
}
});
setVisible(true);
}
} 展开
import java.awt.*;
import java.awt.event.*;
public class ChatClient extends Frame{
TextField tf=new TextField();
TextArea ta=new TextArea();
public static void main(String[] args) {
new ChatClient().launch();
}
public void launch(){
setLocation(300,300);
setSize(400,400);
add(tf,BorderLayout.SOUTH);
add(ta,BorderLayout.NORTH);
pack();
setResizable(true);
this.addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent e){
setVisible(false);
System.exit(0);
}
});
setVisible(true);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询