如何为我的代码修复此错误

时间:2015-07-01 05:06:35

标签: syntax-error

'import java.awt.*;'
'import java.awt.event.*;'

'public void close(){'
'WindowEvent winClosingEvent = new WindowEvent(this,WindowEvent.WINDOW_CLOSING);'
    'Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);
    }'

1 个答案:

答案 0 :(得分:4)

我认为这会帮助你......

public void close() {   
        Window win = new Window(new Frame());
        WindowEvent winClosingEvent = new WindowEvent(win, WindowEvent.WINDOW_CLOSED); 
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);
    }