Closing newly opened JFrame
I'm developing a deskt开发者_JS百科op application using NetBeans IDE.
1) I'm opening a new JFrame after a button click. While I'm closing any of the opened frames, both are getting closed.
2) And I want to update a new Tabbed JPanel on a JFrame after button click. Thanks in advance.
Probably you are using the wrong argument. I guess for the JFrames that you want to close without closing the entire application you are doing:
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
While to actually close only the desired frame without closing rest of the frames you need to do:
jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
1) Why did you create lots of Top-Level Containers on Runtime, create only one JFrame and other would be JDialog(Modality) or JWindow(un-decorated), re-use that,
2) really no battery included in my Magic Globe today, for better and sooner hepl you have to post here SSCCE
I want to update a new
JTabbedPane
on aJFrame
after the button click.
You can just update via a reference to the tab's JPanel
and call repaint()
, but sooner or later you should consider the Model–View–Controller pattern.
精彩评论