Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Weird Java 6 Double-buffering Problem
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!


Report this thread to moderator Post Follow-up to this message
Old Post
SwingGuy
04-21-07 03:03 AM


Re: Weird Java 6 Double-buffering Problem
SwingGuy wrote:
..
>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>

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

Message posted via http://www.webservertalk.com


Report this thread to moderator Post Follow-up to this message
Old Post
Andrew Thompson
04-21-07 09:02 AM


Re: Weird Java 6 Double-buffering Problem
"SwingGuy" <sss@nospam.net> wrote in message
news:SM7Wh.101239$Yr.27152@fe21.usenetserver.com...
>  ...
> 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);
>  ...

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



Report this thread to moderator Post Follow-up to this message
Old Post
Larry Barowski
04-24-07 12:04 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java GUI archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:26 AM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.