Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2007

Tip: Looking for answers? Try searching our database.

Weird Java 6 Double-buffering Problem

Thread view: 
SwingGuy - 20 Apr 2007 19:38 GMT
I'm having a printing issue since upgrading my Swing app from
JDK1.4.2_06 to JDK6.0 (b105).  I think its double buffer related.

As many of you may know, before printing, one must disable double
buffering.  This reduces the amount of data sent to the printer as well
as improving quality drastically because the double buffer at low res
monitor resolution is printed to a high resolution device -- end result
is pixelated blurry text and lines on paper!

Ever since I upgraded my app, my JTable components have been
experiencing this exact problem.  I've set double buffering off
*globally* using the call:

RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);

I confirmed that double buffering is disabled both by setting
breakpoints in my JTable cell renderer and noticing that my app flickers
badly with any onscreen rendering.  Yet, my output to the printer for
*just* JTable components is pixelated and blurry!

Here's one more damning piece of evidence.  If I print to a virtual
device like my Adobe Acrobat PDF generator, the resulting output has
blurry text and lines just the same.  Interestingly, while I'm
*scrolling* the PDF document, I can see it draws a *razor* sharp
vector-based text and lines for just a split second (I zoom in at 500%
view to exaggerate the effect).  But then the razor sharp vector drawn
image is almost instantly covered up with low-res raster copy which I
presume is the on-screen double buffer coming in on top of what was
drawn first.

What is going on here?  Has Java 6 changed double buffering in some way?
 Or is something else at work here causing this problem?  The only
thing I can think of is that double buffering is getting enabled
somehow, without my knowledge, just for the duration of Swing's
rendering for print output.  How can that happen?

Some technical details:

- I am printing a composite component with JLabel, JTable, JButtons
- Everything else is sharp and blurriness only happens on JTable
rendering.  If the JTable doesn't break across the page, it is printed
sharp!  Weird.
- I have a simple custom table cell renderer for each cell of the table.
 I am overriding paintComponent(...) for custom rendering

Help!
Andrew Thompson - 21 Apr 2007 04:56 GMT
...
>Here's one more damning piece of evidence.  

After checking the bug database, I would suggest making
an SSCCE* that demonstrates the behaviour described.

* <http://www.physci.org/codes/sscce.html>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Larry Barowski - 23 Apr 2007 15:14 GMT
>  ...
> Ever since I upgraded my app, my JTable components have been experiencing
[quoted text clipped - 3 lines]
> RepaintManager.currentManager(null).setDoubleBufferingEnabled(false);
>  ...

Since the problem is new in Java 1.6, try:
  RepaintManager.setCurrentManager(new RepaintManager());
to go back to the old style of double buffering.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.