How can I keep the selected state of a JCheckBox after closing and reopening the JFrame containing the JCheckBox?
In a Java Swing application, I have two JFrames, one MainFrame and a 2nd JFrame with a JCheckBox and an OK JButton. In the MainFrame there is an Edit JButton to open the 2nd JFrame. When the 2nd JFrame opens, I select the JCheckBox to true and click OK JButton to close (dispose) the 2nd JFrame. I need the JCheckBox to be selected when I reopen the 2nd JFrame. However, when I open the 2nd JFrame again using the Edit JButton (in the MainFrame) I found the JCheckBox is unchecked. When I select a JCheckBox and close the containing JFrame, I expect that JCheckBox to remain selected when reopening the containing JFrame. Please see my two codes to review this further. https://code.sololearn.com/cXzFEj1ENxQ2/?ref=app https://code.sololearn.com/cOC8aM37v0MY/?ref=app