Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JInternalFrame is making me go crazy

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic