I have a frame and in it is a button named close. What I want I want is if I click on the button, it should unload the frame (not to terminate the whole program). What should I do? What command should I put on the actionPerformed method of the button? Can anybody help me? Thanks!
hide or setVisible(false) will not free the resources used by the frame; they're a good choice if you're going to later show the frame again. Otherwise, use frame.dispose() to get rid of the frame altogether.