How to clear the content of a JFrame?
my code is something like this:
there is a main window with buttons 1 and 2 (2 is for exit)
when I click button 1, a new window should appear with lots of components , etc then inside it is a cancel button , now when i click the cancel button I made its visibility to false (setVisible(false))
now it should be back to the main window , but when I click button 1 again,
the called frame is so messed up , its like a the components has been added again to the frame and the old still remains.