We are using JPanes in a JTabbedPane for a web interface application.
When switching to a tab in the JTabbedPane that already has Graphics2D components drawn on a JPane (lines, etc.), the drawn information disappears.
We currently have the paint() method overrided in the JPane where we are actually drawing graphics.
One work around we have tried was to place code in the JTabbedPane's componentlistener to run when it detects we've switched tabs. That didn't work as the code that runs is done prior to the final refresh of the JTabbedPane, which removes any drawn information.
We had to place a refresh button on the JPane for the user to click (or any other even trigger) to re-draw the information in order for the image/graphics to be seen.
How can we avoid this event-only displaying of our graphics? Is there another tab-switching trigger we are unaware of?
Code examples are available if necessary, but it's a little messy since the tabs are each their own class.
Thanks much.
When switching to a tab in the JTabbedPane that already has Graphics2D components drawn on a JPane (lines, etc.), the drawn information disappears.
We currently have the paint() method overrided in the JPane where we are actually drawing graphics.
One work around we have tried was to place code in the JTabbedPane's componentlistener to run when it detects we've switched tabs. That didn't work as the code that runs is done prior to the final refresh of the JTabbedPane, which removes any drawn information.
We had to place a refresh button on the JPane for the user to click (or any other even trigger) to re-draw the information in order for the image/graphics to be seen.
How can we avoid this event-only displaying of our graphics? Is there another tab-switching trigger we are unaware of?
Code examples are available if necessary, but it's a little messy since the tabs are each their own class.
Thanks much.