开发者

Window Close in Swing Application Problem

开发者 https://www.devze.com 2023-02-25 08:32 出处:网络
i have build a swing application and there are 3 frames frame-1 contains button that open frame-2 and frame3.Now when i click on the close on top right co开发者_开发知识库rner in either frame 2 or fr

i have build a swing application and there are 3 frames

frame-1 contains button that open frame-2 and frame3. Now when i click on the close on top right co开发者_开发知识库rner in either frame 2 or frame 3 ,the whole application closes(frame 1 too closes)

What shall i do to avoid this ?


Do this for the frames you want to close but do not want the whole application to close when you close them:

theFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
0

精彩评论

暂无评论...
验证码 换一张
取 消