'import java.awt.*;'
'import java.awt.event.*;'
'public void close(){'
'WindowEvent winClosingEvent = new WindowEvent(this,WindowEvent.WINDOW_CLOSING);'
'Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);
}'
答案 0 :(得分:4)
我认为这会帮助你......
public void close() {
Window win = new Window(new Frame());
WindowEvent winClosingEvent = new WindowEvent(win, WindowEvent.WINDOW_CLOSED);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);
}