Hiding the JInternalFrame's title bar

I would like like to know if there’s a way to hide completely the title bar of a

JInternalFrame so that it displays more like an AWT Canvas. I’m using JMEDesktop

and creating a JInternalFrame that contains my menu buttons.



Although this is more suited to a Swing forum, I’ve seen some screenshots of

Roll-A-Rama(darkfrog) where a menu is displayed like that and I’m guessing darkfrog

is using JMEDesktop. If so, someone has done it already.





Darkfrog, can you throw me some pointers?



Is there any other way that I can do this?



Thanks,



prowler

simply use a JPanel instead of a JInternalFrame :slight_smile:

I have already done that and it doen's work. The panel is never shown.

I don't think you can add a JPanel or any other component directly to

a JDesktopPane, other than a JInternalFrame.

Digging through the code of BasicInternalFrameUI I noticed there's a method:

protected JComponent createNorthPane(JInternalFrame w) which in all

implementations returns an instance of the BasicInternalFrameTitlePane class.

So I guess I could just create my one UI class and return null or ampty panel to avoid

NPEs, although this is a bit of a hack…



Any suggestions? Darkfrog?

Have a look at TestJMEDesktop it does add a JPanel and other components (buttons etc.) directly to the desktop. Most likely you are facing layout problems if it does not work for you.



There is no nice way to hide the title of a JInternalFrame - the only way I have found yet does not work properly on Mac. But for you it really makes no sense to use a JInternalFrame instead of a JPanel if you need no title bar…

hehe, here's a snippet (Irrisor is correct, you can add a JPanel directly, you're probably just not explicitly defining the size - required for absolute positioning without a layout manager):


JMEDesktop desktop = new JMEDesktop("Desktop", width, height, input);
desktop.setLocalScale(new Vector3f(0.4f, 0.4f, 0.4f));
desktop.getJDesktop().setBackground(new Color(0.0f, 0.0f, 0.0f, 0.0f));
JPanel panel = new JPanel();
panel.setSize(new Dimension(250, 250));
panel.setLocation(posX, posY);
// do you layout management for your JPanel
// add your components to your panel
desktop.getJDesktop().add(panel);
rootNode.attachChild(desktop);



This is just hammered out code...I think it will work, but it's untested for mistakes. :o

If you continue to have problems drop another post.

darkfrog

Irrisor, you can do it pretty easily if you create your own Look and Feel or extend one.



darkfrog

darkfrog said:

Irrisor, you can do it pretty easily if you create your own Look and Feel or extend one.

Hehe, feel free to extend the system look and feel for all systems :P

hehe, I'll get right on that.  :-o



darkfrog

Yep you're both right! I was setting the location but not the size explicitly!



Thanks!!!



By the way, I think that an InternalFrameListener is also needed in the

showDialog method of TestJMEDesktop in order to restore the focus to the

previous owner properly.