glasspane performance

Hendrik Schreiber hs at tagtraum.com
Thu Mar 27 09:51:24 UTC 2014


Hey..

my application used to use the glasspane for animations, following this simple scheme

- draw initial component state to an image
- draw final component state to an image
- set my own component as glasspane

- the draw the different animation stages in the glasspane component, calling repaint() on the glasspane component with a swing timer

- when the animation is done, re-install the original glasspane

The animation is supposed to last 300ms with 20ms increments. On current laptop hardware running OS X 10.9.2 and JDK 8, I get exactly *no* animation frames. At the same time this works fine on Windows, even running in a Parallels VM on the very same hardware.

Some testing reveals that it's the glasspane's fault. The same animation works (more or less) smoothly, when using a layered pane.
Now, I don't have to use the glasspane (and perhaps I shouldn't), the layered pane works just fine for me. So my initial problem is solved.

But, if I had to use the glasspane, I'd be in trouble. With the current performance, it's fairly unusable.

Looking at the code in JRootPane#setGlassPane(Component), the only thing that sticks out is:

AWTAccessor.getComponentAccessor().setMixingCutoutShape(glass,new Rectangle());

Anyhow. I couldn't find a corresponding bug, so I figured I bring this to your attention. Perhaps this is something you want to investigate further.

Cheers,

-hendrik



More information about the macosx-port-dev mailing list