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.
Top Level Containers (JFrame, JDialog ...) miss implemetations for finalize(), then they are never GC'd
equivalent for JFrame.DISPOSE_ON_CLOSE is only setVisible(false)
you can returns all Top Level Containers from method Window[] wins = Window.getWindows();
you can remove only all JComponents from ContentPane, for return used memory back
EDIT
Focus can listening or firing events from Swing ListenersIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With