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.
Joined: Apr 11, 2005
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?