简体   繁体   中英

Closing newly opened JFrame

I'm developing a desktop 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 a JFrame 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM