Im currently working with JFrames and JPanels.
JFrame - Window with buttons etc. JPanel - Area to be used for paintComponent etc.
I have my mainWindow and a subWindow
mainWindow is a JFrame that calls subWindow which is a JFrame with a JPanel on it.
subWindow uses setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
as i do not want to close everything when i close subWindow
mainWindow calls subWindow via new subWindow();
When i close subWindow and re-open another instance of it, the old paintComponent stuff are still in the JPanel. i.e If i print a circle the first time it will still be there in the new instance of the subWindow.
I've noticed that when subWindow is re-opened the old variables used are still present instead of well, being new.
How can i manually dump everything when i exit subWindow? And why is it so when i called a new instance of subWindow the old variables still remain?