How to close a jframe without closing the main program

后端 未结 9 1868
天涯浪人
天涯浪人 2020-12-06 11:06

I\'m creating a program to keep track of a list of DVD\'s. On the main page I have set up 2 JButtons. When the user clicks the one that says new, a new JFrame from another c

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 11:20

    I had a similar problem and used jFrameInstanceVariable.setVisible(false); as the action that occured when I hit my CANCEL button. But every time I clicked the button that popped up the JFrame afterward, all the old content was still there in addition to the new content created from pressing the button.

    I fixed this by making a new instance of JFrame every time the button is pressed that pops up the JFrame.

提交回复
热议问题