Skip to main content

changing swing.volatileImageBufferEnabled dynamically?

1 reply [Last post]
Anonymous

I asked this about a week ago and didn't get a response, so let me
try again.

If there is another list that might be more appropriate, I'd
appreciate that info too.

Is there a way to change the behavior of a Java app at runtime that
will switch from enabling and disabling the volatile image buffer in
Swing? Ie, the equivalent of setting swing.volatileImageBufferEnabled
to true or false while the app is running?

Or is this property only read once, at JVM startup, and never
consulted again?

I have some code that draws fine with
swing.volatileImageBufferEnabled=true, and other code that craps out
on me, so I'd like to change the setting as needed depending on what
is being drawn.

Thanks!

Rob Ross, Senior Software Engineer
E! Networks
rross@eentertainment.com
---------------------------------------------------
"Beware of he who would deny you access to information, for in his
heart he dreams himself your master." -- Commissioner Pravin Lal

===========================================================================
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 Rob,

On Apr 5, 2006, at 8:42 AM, Rob Ross wrote:
> I asked this about a week ago and didn't get a response, so let me
> try again.
>
> If there is another list that might be more appropriate, I'd
> appreciate that info too.
>

Have you asked on the Swing forum on java.net? This is more of a
Swing question and I'm sure those guys can help you out there:
http://forums.java.net/jive/forum.jspa?forumID=74

> Is there a way to change the behavior of a Java app at runtime that
> will switch from enabling and disabling the volatile image buffer in
> Swing? Ie, the equivalent of setting swing.volatileImageBufferEnabled
> to true or false while the app is running?
>

I'm not positive, but... When you detect that the use of
VolatileImages should be disabled (when you're about to use
QuickTime), you may be able to override
RepaintManager.getVolatileOffscreenBuffer() to return null, at which
point Swing will fall back on a non-accelerated image. Note that in
Mustang this may cause the "gray rect" fix to be disabled (the Swing
team could confirm this), but I'm not sure how important this is to
your application.

In any case, the reason you see problems when the Swing backbuffer is
a VolatileImage on Windows is probably related to our use of
DirectDraw. Do you see any of these problems if you specify -
Dsun.java2d.noddraw=true on the command line?

> Or is this property only read once, at JVM startup, and never
> consulted again?
>

This appears to be the case.

Thanks,
Chris

> I have some code that draws fine with
> swing.volatileImageBufferEnabled=true, and other code that craps out
> on me, so I'd like to change the setting as needed depending on what
> is being drawn.
>
> Thanks!
>
>
> Rob Ross, Senior Software Engineer
> E! Networks
> rross@eentertainment.com
> ---------------------------------------------------
> "Beware of he who would deny you access to information, for in his
> heart he dreams himself your master." -- Commissioner Pravin Lal
>
> ======================================================================
> =====
> 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".