Archived

This topic is now archived and is closed to further replies.

Enigma

[java] JToolBar visibility - Not really game related

Recommended Posts

Enigma    1410
Sorry to post a non game development related item, but I''m having a problem with JToolBars. I''ve already posted on the Sun Java site and got no replies (admittedly it''s only been up for 24 hours). Basically I have a JFrame with a JToolBar in it. When you float the JToolBar away from the edge of the JFrame and then select the JFrame title bar, the JFrame becomes the active window and moves to the front, obscuring the JToolBar. Does anybody know of a way of keeping the JToolBar at the front? I''ve tried emulating a floating JToolBar with a JInternalFrame, but I keep hitting problems dragging it without it being visible. I thought you guys would probably be the kind of people who try and do non-standard stuff with Java components - any ideas? Thanks a lot Enigma ------ ...who only helps those who help themselves. ...

Share this post


Link to post
Share on other sites
Enigma    1410
My JRE is version 1.3. I''ll try and get some more specific details later (when I have time).

Thanks for the reply (first I''ve had in two forums!)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
In Java 1.3, JToolBars are bugged when undocked. JToolBars are placed into their own JFrame''s when the bar is floating. This is why when you switch to your applications main JFrame it will have the undesirable behaviour of obsuring your undocked toolbar. To fix this so that your undocked JToolBars are not obscured, you will need to customize JToolBars look and feel to place undocked JToolBars into a non-modal JDialog instead of a JFrame. Have a look at javax.swing.plaf.basic.BasicToolBarUI class and the javax.swing.JComponent.setUI() method.

This bug is fixed in Java 1.4 which is still currently in beta

Share this post


Link to post
Share on other sites