aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JInternalFrame is making me go crazy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JInternalFrame is making me go crazy" Watch "JInternalFrame is making me go crazy" New topic
Author

JInternalFrame is making me go crazy

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Hi,

I've got a test application with a JInternalFrame added to a JDesktopPane.
This works fine, but when I try to repeat this in my other big program,
the JInternalFrame just won't show up.

There is too much code to paste it, but essentially...

Drawer3 extends Drawer extends JDesktopPane

Inside Drawer3(Singleton class) class:


And in the class with main method...

So the Drawer3 object displays fine, but the JInternalFrame doesn't show,
but when you move the mouse you can see where the edges of the
JInternalFrame are by the way it lets you stretch it, but its not visible.

I've tried for a while to get this working, but I can't see it.
Please can you let me know if you can see any reasons why the code above
should prevent the JInternalFrame from being visible.

Thanks
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Well I found the reason, but don't know why.

Seems that when I include g.dispose() at the end of the
paintComponent(Graphics g) method in a subclass of
JDesktopPane, then the JInternalFrame added to this instance
does not display.

If I remove g.dispose(), then the JInternalFrame becomes visible.

This leads to my next question...
In my application I am doing a lot of repainting frequently.
Should I manually invoke g.dispose() at the times when the
JInternalFrame is not on display, then not invoke g.dispose()
when it needs to be shown?

Thanks
Darrin Cartwright
Ranch Hand

Joined: Dec 27, 2002
Posts: 107
Hi Colin,

I'm glad you figured it out! It was making me scratch my head.
Anyway, could you not just use setVisible(true|false) to control the internal frames?

Darrin


Life is good on the Ponderosa,<br />but mind where you step.
 
Consider Paul's rocket mass heater.
 
subject: JInternalFrame is making me go crazy