Link to home
Start Free TrialLog in
Avatar of waffe
waffeFlag for United States of America

asked on

JtoolBar and BasicToolBarUI - JToolBar will not stay on top!

Hi

I have a JToolBar that I am using in conjunction with a BasicToolBarUI that allows me to start the toolbar in a floating state - Great! The problem now is the floating toolbar does not stay on top of all the windows; in fact, it goes behind all of them including the JFrame.

Is there a way to keep the floating toolbar using BasicToolBarUI on top of all windows?

Thanks,

waffe
Avatar of appxpete
appxpete

Avatar of waffe

ASKER

I've been working with this link but nothing seems to pan out. My script is different than the example in the link - thanks but I think my problem is slightly different.

Why does the toolbar go behind any window when you use it in conjunction with BasicToolBarUI? / Is there a different way to start the toolbar in a floating state and still have it hold its top window focus?

waffe
Avatar of hoomanv
a bit googling made me believe that this functionality is not yet available in pure java. some people had tried it thru JNI but no code were available. therefor the solution is somthing other than JToolBar, say for example a JDialog. I mean you should make the toolbar UN floatable. and whenever the user tries to float it, you have to take control of everything, poping up a JDilaog (which is always on top) and surely hide/remove the toolbar ...
sorry, I dont have any idea on how you can implement it
Avatar of waffe

ASKER

I have also been working two JInternalFrames and a JDesktopPane. I put the toolbar in one JInternalFrames and my other content in the other JInternalFrames and I add them both to a   JDesktopPane - Great! Now how do I force a JInternalFrame to always stay on top of another?
Avatar of waffe

ASKER

Thanks,

It kind of works, the JInternalFrame that holds the toolbar is on top until the main content (not the frame) of the other JInternalFrame is moved over the toolBar JInternalFrame.

I believe my problem is because the other JInternalFrame has an applet from a java program call Processing. I had a similar problem with a JMenuBar here that was resolved. https://www.experts-exchange.com/questions/21851443/ZOrder-problem-with-processing-and-eclipse.html 
Can the same methodology be applied to a JInternalFrame?

Thanks,

waffe
Avatar of waffe

ASKER

To add....

The JInternalFrame that has the processing applet in it is always above all components except the JMenuBar with this command added to it - JPopupMenu.setDefaultLightWeightPopupEnabled(false);

waffe
Avatar of waffe

ASKER

Found the problem - I think - The processing applet (PApplet) extends Applet which is an AWT or heavyweight component. Swing components are considered lightweight and there is a layering problem that comes into play when using these two types of components.

Looks like I may have to go to AWT instead of swing for my GUI - BOOOOOOOOOOOO!!!!!!!!!

Thanks for you suggestions.

4dplane
Avatar of waffe

ASKER

Here is a link that describes heavy and light weight components.
http://java.sun.com/products/jfc/tsc/articles/mixing/
ASKER CERTIFIED SOLUTION
Avatar of Netminder
Netminder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial