JTabbedPane setIconAt animated gif, causing continuous repaints, high cpu%
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.