Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在java中按下特定按钮时关闭上一个窗口我该怎么做
我的意思是,在我点击注册后,我希望关闭名为“Yuval Library”的窗口
如果您想模拟“X”的单击,则将 windowEvent(在这种情况下为关闭)发送到“Yuval 库”。
jframe.dispatchEvent(new WindowEvent(jframe, WindowEvent.WINDOW_CLOSING));
如果你想简单地关闭 JFrame 处置它:
jframe.dispose();