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);
}
}
}
程序课正常运行,可是点右上角的叉号就是关闭不了啊,我注册了适配器的啊?为什么呢?有大哥能帮着解决下吗?
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);
}
}
}
程序课正常运行,可是点右上角的叉号就是关闭不了啊,我注册了适配器的啊?为什么呢?有大哥能帮着解决下吗?