I'm not a swing developer, but I'd suggest to not use static field for
cache, but have per-AppContext cache instead (due to security reasons)
(see JComponent.focusController or ImageIcon.getTracker() as examples).
Regards, Oleg.
Roman Kennke wrote:
Hi,
I have an application here, that has a lot of buttons with image icons,
all have the same icon, and many of them get disabled. This leads to
gray-filtering the icons, and since they are all the same, the
grayfilter filters the same icon over and over again. I think this can
be optimized by introducing a cache like in the attached patch.
Now I am not sure if this change is feasible. There is a (very small)
chance that somebody uses this to filter changing images. For example,
somebody could filter a BufferedImage, then draw into that and filter it
again (to refresh the gray representation or so). I would guess that
nobody really does this, but what do I know? In this case, he would get
the old gray image in return.
What do you think about that, could this be included in OpenJDK?
Cheers, Roman