java swing close window without exiting app

后端 未结 8 1598
慢半拍i
慢半拍i 2021-01-12 04:31

I have a little frame where I ask user & password. This frame will be opened clicking over a button in a main window.

Then I have two buttons: ok and cancel.

8条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 05:01

    You can do it in many ways but these two ways are most usable one
    1. write this.setVisible(false) in inside implemented ActionListener
    Or
    2. write this.dispose() inside implemented ActionListener. Hope this will help you.

提交回复
热议问题