Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTabbedPane setIconAt animated gif, causing continuous repaints, high cpu%

843806May 6 2009
Hello.

I have an application where I have a long task running in a swingworker, and wanted to have a loading animation (16x16 animated gif) appear in the tab associated with that data.

I disable the tab and use a

jTabbedPaneTop.setDisabledIconAt(Tabs.DiskAndArrayHealth.GetValue().GetSmallBusyIcon());

my GetSmallBusyIcon() returns a static ImageIcon, so nothing exotic going on.

In my Tab Pane that is disabled and has the animated busy icon, the paintComponent() of child controls gets called hundreds of times in a short duration. This causes the cpu usage on a V480 to spike considerably. Is there any way to avoid this? My paintComponent() simply draws 12 polygons and fills them, and is normally only called once each time the data changes, and has a minimal performance impact.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2009
Added on May 6 2009
0 comments
198 views