aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
Author

plugin JFrame closes app on close operation

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 236
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,

Alan

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4522
    
    5

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: 236
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.

Alan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: plugin JFrame closes app on close operation
 
Similar Threads
Spreading out JLabels in a panel
where is the frame and its components
regarding JTable issue
Properly shutting off logging
Multiple JFrames in 1 Container