-   Programming (
-   -   Java - repaint on tabbedpane (

hunterfighter 09-23-2006 08:09 AM

Java - repaint on tabbedpane
I had a problem when I using the tabbed pane in Java. I create a tabbed pane. I add a panel on it.
When I click the close button which is coded to remove the panel from the tabbed pane. It still appear the drawing on the screen. Even the component is really been removed.
So, I minimize the application and restore back it. It only will repaint or refresh the screen for me.
Any idea to overcome the problem?

mrcheeks 09-23-2006 11:13 AM

Try repainting and revalidating the JTabbedPane

// create the tabbedpane and add a panel
JPanel panel = new JPanel();
JTabbedPane jtp = new JTabbedPane();
jtp.addTab("Panel", panel);

// remove the panel

hunterfighter 09-23-2006 11:49 AM

Yeah the result still remain the same. Still can't make it repaint or refresh.
It only work sometimes. Depends on luck.

mrcheeks 09-23-2006 01:50 PM

try revalidate before repaint to see if it is better

hunterfighter 09-23-2006 01:55 PM

It still the same. I try with


it still same.

hunterfighter 09-23-2006 11:31 PM

Will different OS different effect?

xhi 09-24-2006 12:11 AM

i have run into some weird repaint issues before as well. its probably because i do not know the *right* way to do it, and what i do is probably cheating a bit. what i would do, that would work for sure, is to toggle the visibility of the component. do a



this will guarantee a repaint.

hunterfighter 09-25-2006 07:46 AM

At last I know what the problem. You use any other library file for tabbedPane beside from Sun Java itself?
I use the 3rd party library file it got problem. after I use bak the original library file from Sun, it seems like no problem.
And I try your cheating skill. Haha it can't work for me. I better use back the original library file from Sun Java.

All times are GMT -5. The time now is 01:12 AM.