Solved

Distorted Java Graphics

Posted on 2002-07-09
8
668 Views
Last Modified: 2008-02-01
My java gui is distorted.
Does anybody know how to repair it ?
I'm using Matrox graphics card G450 dualhead on Windows 2k platform ..

Distortion looks like this:
http://piencak.host.sk/java/distortion.html
It appears everytime I scroll, after clicking into scrollpane it redraws itself. The problem is in my programs and in JBuilder gui also.

Thanks for help.
0
Comment
Question by:MirecXP
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 92

Assisted Solution

by:objects
objects earned 50 total points
ID: 7142051
Have also seen that, I assume it's a Java bug related to the video card.  Haven't seen a bug report related to it though so it may be worth reporting to Sun.
0
 
LVL 2

Expert Comment

by:mzimmer74
ID: 7142293
I've also ran into this, but just tend to ignore it as I haven't found a good solution yet.  I suppose that what you might be able to do is listen to the scroll bar changing and when it stops call repaint (or revalidate) on the scrollpane.  This might solve your problem.
0
 
LVL 2

Expert Comment

by:keithlong
ID: 7240596
This is just not a bug.. I can't believe you guys.. "Video Card problems??"

it's a feature of JScrollPane and Tables / Trees..

Basically it's how the graphics are painted:
each row is cached when painted the last row is not neccesarily all visible.

If you debug the paint method you'd find that one of the them last one painted has a very small height than the others "an obvious feature yes".

I'm not to fond either. but there is a work around and this is what took the time. Working out the relationship between JTable the UI, and the ScrollPanel.

The table has special code along with the tree, it acts differently when in a JScrollPane :(

it's a one line fix that in my opinion is worth more than 40 measily points
scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);

there are two other options
public static final int BLIT_SCROLL_MODE = 1;
public static final int BACKINGSTORE_SCROLL_MODE = 2;

I recommend you to use the SIMPLE_SCROLL if you haven't got a lot of paint to do..  BLIT was awful for me, BACKINGSTORE didn't work well for me either.

Regards

Keith Long
www.technogenius.co.uk
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 92

Expert Comment

by:objects
ID: 7240979
> This is just not a bug.. I can't believe you
> guys.. "Video Card problems??"

Then why doesn't it occur on all machines??

> Basically it's how the graphics are painted

So all scrolled graphics are painted incorrectly??
0
 
LVL 2

Accepted Solution

by:
keithlong earned 50 total points
ID: 7241378

No, all scrolled graphics are not painted incorrectly. It only happens when you have something like a table which paints rows in a new GraphicsContext each row normally has a height of 20, the last one ends up with a height of 4 so when you scroll up.

The backing store is going to remember what that paint looked like. so you are going to get the effect of most of the rows being squashed.

more info on the BackingStore:
http://java.sun.com/products/jfc/tsc/articles/performance/

All of the BackingStore is implemented in JViewPort and it's just basically an offscreen drawing like most of us have used hundreds of times.

At the same time, I can not see how this can be affected by videocards. If you do have the ability to test this, could you additionally try obscuring a window as well.

For me, this is no longer an issue as I do not realy need to use the backing store. If you believe that this is a video card issue there is an easy way to test add this to your jvm
-Dswing.volatileImageBufferEnabled=false
Corrosponds to line [60] of repaintManager.

This wil stop JViewPort using videoCard memory (volatile memory).

With my laptop video card, this does not "appear" to do anything different.

I'm really interested in finding out what happens with your system on this one.

Regards

Keith Long
www.technogenius.co.uk
0
 
LVL 1

Author Comment

by:MirecXP
ID: 7241781
This time I'm using JDK 1.4, which doesn't seem to be buggy in this way.

I've tried your suggestions, Keithlong, it works fine, it seems BLIT_SCROLL_MODE has bug related to the video card (as Objects has said). The other two modes (backing-store and simple) are working well.

Although offerring nice workaround I'd like to leave this question open, because your answer solves problems of my programs, but not the problem with other programs, which are distributed without sources. (JBuilder 6, for example)

Regards, Mirec.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8916925
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- split points between keithlong and objects

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0
 
LVL 1

Author Comment

by:MirecXP
ID: 8916990
I have also encountered this problem with many others Matrox video cards.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
replace a word with other 1 44
web services creation SOAP vs REST 5 41
login jsp example 24 50
difference between sorce folder and folder in eclipise 3 13
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question