Hi I was wondering if there is a way to set a jbutton to do the equivalent of setdefaultcloseoperation(JFrame.DISPOSE_ON_CLOSE) because I dont understand how a frame object is eligible for collection if it still has listeners when the frame is set invisible. I can send code if this doesn’t make sense.
Share
Top Level Containers (
JFrame,JDialog…) miss implemetations forfinalize(), then they are never GC’dequivalent for
JFrame.DISPOSE_ON_CLOSEis onlysetVisible(false)you can returns all Top Level Containers from method
Window[] wins = Window.getWindows();you can remove only all
JComponentsfromContentPane, for return used memory backEDIT
Focuscan listening or firing events from Swing Listeners