create a JFrame and show it----> 显示一个窗口
call the window's setVisible(false) and dispose()--->窗口关掉.
Others you have to use event. But the above is enough.