Y
yakovfain
Hello,
There are several buttons on a Swing window, and the titiles of these
buttons are changing about a dozen times a second (sort of a dashboard
application). I need to speed up this processing as much as possible.
The current code is calling repaint() for each display of the new
button title. I'm thinking of using the Swing Timer class setting the
button's title directly. Is this more efficient?
Also, multiple repaints go to the event queue in a non-guaranteed
sequence.
One more question, the current code is performing if (src instanceof
JButton) then cast to JButton. In general, instanceof is an expensive
operation. Do you think that casting without the type check, but with
catching a ClassCastException would be faster?
Thanks,
Yakov
There are several buttons on a Swing window, and the titiles of these
buttons are changing about a dozen times a second (sort of a dashboard
application). I need to speed up this processing as much as possible.
The current code is calling repaint() for each display of the new
button title. I'm thinking of using the Swing Timer class setting the
button's title directly. Is this more efficient?
Also, multiple repaints go to the event queue in a non-guaranteed
sequence.
One more question, the current code is performing if (src instanceof
JButton) then cast to JButton. In general, instanceof is an expensive
operation. Do you think that casting without the type check, but with
catching a ClassCastException would be faster?
Thanks,
Yakov