How to set a JDialog owner to a TopComponent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
cab
Reply | Threaded
Open this post in threaded view
|

How to set a JDialog owner to a TopComponent

cab
Hi all,

I'm not sure if this is possible.

I have a netbeans plugin I created, which is installed onto a custom netbeans IDE. This plugin has a bunch of topcomponents. Sometimes I need to bring up a custom dialog, and I want this dialog to stay on top of the IDE (when the IDE is minimized, I want this dialog minimized, and when the IDE is brought back up, I want the dialog to be on top).

So, I want to set the JDialog window owner, but I don't know what I can set it to. I thought I could set it to one of my topcomponents, but this does not look possible. Does anyone have any suggestions?




Reply | Threaded
Open this post in threaded view
|

Re: How to set a JDialog owner to a TopComponent

Neil C Smith-2
Hi,

On Fri, 6 Oct 2017, 10:50 cab, <[hidden email]> wrote:

So, I want to set the JDialog window owner, but I don't know what I can set it to. I thought I could set it to one of my topcomponents, but this does not look possible. Does anyone have any suggestions?

SwingUtilities.getWindowAncestor on the TopComponent might be a good option. There's also a NetBeans API to get the MainWindow, but not sure from memory how that handles undocked TCs.

Best wishes, 

Neil
--
Neil C Smith
Artist & Technologist

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Reply | Threaded
Open this post in threaded view
|

Re: How to set a JDialog owner to a TopComponent

stephen cumminger

Try WindowManager.getDefault().getMainWindow() to get the IDE/RCP frame.

 

Regards,

 

 

Stephen Cumminger

 

From: Neil C Smith [mailto:[hidden email]]
Sent: Friday, October 6, 2017 6:53 AM
To: dev <[hidden email]>
Subject: [platform-dev] Re: How to set a JDialog owner to a TopComponent

 

Hi,

On Fri, 6 Oct 2017, 10:50 cab, <[hidden email]> wrote:


So, I want to set the JDialog window owner, but I don't know what I can set it to. I thought I could set it to one of my topcomponents, but this does not look possible. Does anyone have any suggestions?

 

SwingUtilities.getWindowAncestor on the TopComponent might be a good option. There's also a NetBeans API to get the MainWindow, but not sure from memory how that handles undocked TCs.

 

Best wishes, 

 

Neil

--

Neil C Smith

Artist & Technologist

 

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org