Skip to main content

Repaint flicker when mixing swing & heavyweight

1 reply [Last post]
Anonymous

I'm writing an application that uses JOGL, and so necessarily contains a
heavyweight component that extends Canvas. However, most of the
application uses Swing, including a component of my own design that
extends JComponent and has a complex repaint routine. While my
component works properly, when I move the mouse over it when the Canvas
is visible, it flickers rapidly between it's normal display and a blank
rectangle of the clear color.

What can I do to stabilize my component so it doesn't flicker?

Mark McKay

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris Campbell

Hi Mark,

You can probably get a more detailed answer if you ask this question
over on the javagaming.org JOGL forum, but...

Is your GLCanvas embedded within the bounds of another JComponent?
In this case, it is common to see flickering issues due to
heavyweight/lightweight mixing. It's tough to say though without
knowing exactly how the components are laid out in your application.

You mention that your app "necessarily" contains a heavyweight; have
you looked into using GLJPanel instead? GLJPanel allows for 100%
correct mixing of JOGL and Swing in the same app without worrying
about flickering issues, and in JDK 6 and beyond, it is fully
accelerated when the OGL-based Java 2D pipeline is enabled.

Chris

On May 26, 2006, at 5:39 PM, Mark McKay wrote:
> I'm writing an application that uses JOGL, and so necessarily
> contains a
> heavyweight component that extends Canvas. However, most of the
> application uses Swing, including a component of my own design that
> extends JComponent and has a complex repaint routine. While my
> component works properly, when I move the mouse over it when the
> Canvas
> is visible, it flickers rapidly between it's normal display and a
> blank
> rectangle of the clear color.
>
> What can I do to stabilize my component so it doesn't flicker?
>
> Mark McKay
>
> ======================================================================
> =====
> To unsubscribe, send email to listserv@java.sun.com and include in
> the body
> of the message "signoff JAVA2D-INTEREST". For general help, send
> email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".