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)
精彩评论