J
Jesse Pavel
Hello,
I'm having a problem with the text of Swing menus being painted properly
when a lot of other drawing operations are being performed. An example
will make it clearer:
In the Java2D demo that comes with the JDK (in the demo/jfc/Java2D direcotory)
I run the BezierCurve demonstration, and if I reduce the animation delay enough,
menus don't paint properly. Clicking on the Options menu, for instance, clears a
gray box on the screen, but the menu items are not drawn unless I hover the
mouse cursor on top of them.
Looking at the code for the demos, I see that the animation works by spawning
a separate thread which in turn calls the repaint() method of the component that
is drawn upon (the Surface). repaint(), if I understand it correctly, appends
an event on the Swing queue, which will be processed by the event dispatch
thread in its turn. I am guessing that if the events are queued faster than
they can be processed, Swing is not getting the chance to paint the menu items,
which perhaps it does only when no events are pending?
Does anyone have an idea on how to fix this problem? Can one ensure that UI-
generated events bypass certain thread-generated events?
Thanks for any help,
Jesse
I'm having a problem with the text of Swing menus being painted properly
when a lot of other drawing operations are being performed. An example
will make it clearer:
In the Java2D demo that comes with the JDK (in the demo/jfc/Java2D direcotory)
I run the BezierCurve demonstration, and if I reduce the animation delay enough,
menus don't paint properly. Clicking on the Options menu, for instance, clears a
gray box on the screen, but the menu items are not drawn unless I hover the
mouse cursor on top of them.
Looking at the code for the demos, I see that the animation works by spawning
a separate thread which in turn calls the repaint() method of the component that
is drawn upon (the Surface). repaint(), if I understand it correctly, appends
an event on the Swing queue, which will be processed by the event dispatch
thread in its turn. I am guessing that if the events are queued faster than
they can be processed, Swing is not getting the chance to paint the menu items,
which perhaps it does only when no events are pending?
Does anyone have an idea on how to fix this problem? Can one ensure that UI-
generated events bypass certain thread-generated events?
Thanks for any help,
Jesse