File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes plugin JFrame closes app on close operation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "plugin JFrame closes app on close operation" Watch "plugin JFrame closes app on close operation" New topic

plugin JFrame closes app on close operation

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
HI Guys,

I thought I just had a eurika moment when my plugin feature for my project appeared to be working, but not everything is working as expected. I've set up for my project the ability to include plugins and I wanted to have the ability to allow the plugins to have their own Graphical User Interface. So I set up a plugin class that extends JFrame to just display a couple simple JLabels to prove it was launching properly with a reference back to the main application. All of this part is certainly working for me, until I went to close the plugins JFrame! When I did that, the whole application closed. I didn't expect that. I expected the main application to remain running, and for the plugin's window to close independantly. My understanding is that a plugin is supposed to run in its own thread context, so why do I see this behavior? How do I fix it? Is there a property I'm missing that I should be setting?

Following are the two classes that make up the plugin. There's nothing special about them. I'm just obviously missing something that should be incorporated to prevent the TestFrameA from shutting down the application when I go to close it.

Please advise,


Darryl Burke

Joined: May 03, 2008
Posts: 5115

So what did you think this line does?

Alan Shiers wrote:

luck, db
There are no new questions, but there may be new answers.
Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
Damn! It had to be somethng stupid, didn't it! I've used that line this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) so many times in previous projects I didn't expect it to crash the whole app in this particular scenario. I changed it to this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE). That worked. Thanks for the guidance.

I agree. Here's the link:
subject: plugin JFrame closes app on close operation
It's not a secret anymore!