Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: turn off double buffering



this may or not help, but you appear to have the same issues as we did and we solved it in the following way (which works on all supported platforms including OS X since 10.0!)

We have a main JFrame, containing a JPanel.
We keep an offscreen BufferedImage, and an onscreen BufferedImage.
Changes are made to the offscreen image, and then using graphics.setClip() we paint only the changed area in paintComponent() for the JPanel.


To eliminate offbyone pixel errors when plotting to the screen all coordinates are stored scaled to a 64K grid, and a working set is kept that are scaled to the client area (I guess in your case your reference-points are the ones in the file here, but the important thing is to rescale from a reference set not from the working set - otherwise any lines drawn on the screen appear to jump around if the client area is repeatedly resized)
When the client area dimensions are changed we recreate the off- and on-screen images, recreate the working points from the reference points and draw them to the offscreen image, then setClip() to the size of the JPanel to "blt" the entire image.


We have found this to be the fastest way of displaying data in real- time - and since JVM1.5 OS X (both Tiger and Leopard) is actually faster than Win32. As always, the important thing is to repaint only the smallest possible area.


email@hidden http://www.veytisou.com



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.