java吧 关注:1,233,184贴子:12,698,892
  • 0回复贴,共1

各位大哥帮帮忙,小弟刚上路,在线等,谢谢

只看楼主收藏回复

package Layout;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class ShowLayout extends Frame {
public ShowLayout()
{ super("Flow Layout");
setLayout(new FlowLayout());
add(new Button("Button 1"));
add(new Button("Button 2"));
add(new Button("Button 3"));
add(new Button("Button 4"));
add(new Button("Button 5"));
addWindowListener(new WindowCloser());
pack();
setVisible(true);
}
public static void main(String []args)
{
ShowLayout fl=new ShowLayout();
}
private class WindowCloser extends WindowAdapter implements WindowListener
{
public void WindowClosing(WindowEvent we)
{
System.exit(0);
}
}
}
程序课正常运行,可是点右上角的叉号就是关闭不了啊,我注册了适配器的啊?为什么呢?有大哥能帮着解决下吗?


1楼2016-04-07 19:55回复