Re: How close fxml window by controller?
Posted: Tue Oct 31, 2017 5:19 pm
That depends, would you like to reuse the window or not?
Frames and InternalFrames are "opened" by simply setting them to visible:
Analogues, closing them means to set the them simply invisible:
This also allows to easily keep using and reuse Frames and InternalFrames, because the container itself is actually not destroyed. One can still access all the components which have been added to the Frame or InternalFrame.
If one wants to actually "destroy" the Frame or InternalFrame, without the ability to reuse it, that can also be done:
Note that there is the isDisposed() method which can be used to determine whether a Frame or InternalFrame has already been disposed. A disposed Frame or InternalFrame should not be reused.
Frames and InternalFrames are "opened" by simply setting them to visible:
- Code: Select all
internalFrame.setVisible(true);
Analogues, closing them means to set the them simply invisible:
- Code: Select all
internalFrame.setVisible(false);
This also allows to easily keep using and reuse Frames and InternalFrames, because the container itself is actually not destroyed. One can still access all the components which have been added to the Frame or InternalFrame.
If one wants to actually "destroy" the Frame or InternalFrame, without the ability to reuse it, that can also be done:
- Code: Select all
internalFrame.dispose();
Note that there is the isDisposed() method which can be used to determine whether a Frame or InternalFrame has already been disposed. A disposed Frame or InternalFrame should not be reused.