Solved

JScrollPane painting problem with multiple screens

Posted on 2004-04-08
10
314 Views
Last Modified: 2008-03-17
I have a JTable inside a JScrollPane.  When the frame is stretched across more than one screen and the vertical scrollbar is moved, only the portion of the table on the left screen gets repainted properly.

I am running Windows XP professional, matrox g200 multi-monitor.  I have tried this with jdk1.3.1_11 and j2sdk1.4.2_04.  Both have the same problem.

I can't be 100% sure, but I don't think we had this problem when running with Windows NT across multiple screens.

Any suggestions please?


import java.awt.*;
import javax.swing.*;


class TestTable {


      public static void main( String[] args ) throws Exception {
            Object[][] data = new Object[100][100];
            String[] cols = new String[100];

            for (int i=0; i<100; i++) {
                  cols[i] = String.valueOf( 'A'+i );
                  for (int j=0; j<100; j++) {
                        data[i][j] = String.valueOf( 'A'+i );
                  }
            }

            JTable t = new JTable( data, cols );
            JScrollPane sp = new JScrollPane( t );

            JFrame f = new JFrame();
            f.getContentPane().add( sp );
            f.pack();
            f.show();
            f.setDefaultCloseOperation( f.EXIT_ON_CLOSE );

      }
}
0
Comment
Question by:amswain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 10782338
Try adding your JScrollPane to a JPanel first and then add the JPanel to the JFrame. See if that helps.

>> f.setDefaultCloseOperation( f.EXIT_ON_CLOSE );

- the better way to call it would be:

f.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE ) ; // EXIT_ON_CLOSE is static
0
 
LVL 1

Author Comment

by:amswain
ID: 10782399
a) No effect (and why would it)?  b) It's only a test program and I'm a lazy typist.
0
 
LVL 1

Author Comment

by:amswain
ID: 10782408
BTW, I have also tried running with
-Dsun.java2d.ddlock=true and
-Dsun.java2d.noddraw=true
with no improvement
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 30

Expert Comment

by:Mayank S
ID: 10782421
>>  why would it

'coz in some cases, putting a JPanel is often very useful.

>> It's only a test program and I'm a lazy typist

You can copy-paste. BTW, in the original program, what is the layout that you have?
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 10785159
I have tested your code on my machine, and i don't have any refresh problems.
GF4 MX460 spanning accross my CRT monitor and my TV.
Using j2se 1.4.2_01 and WinXP.
It looks like java sends messages that are not relayed by the multi-screen driver.
Java might be using native commands that are not supported by the driver???
Do you have the latest driver installed for your Matrox?
0
 
LVL 92

Expert Comment

by:objects
ID: 10787583
Sounds like potentially a java bug with that card.
0
 
LVL 1

Author Comment

by:amswain
ID: 10811509
I have found another bug which I think is related.  Running the same program (above) with this small change

            JTable t = new JTable( data, cols ) {
                  public String getToolTipText( MouseEvent e ) {
                        int r = rowAtPoint( e.getPoint() );
                        int c = columnAtPoint( e.getPoint() );
                        Object value = getValueAt( r, c );
                        return value==null ? null : value.toString();
                  }
            };

with the table stretched across multiple screens, the tooltip always appears on the left screen, even when the mouse is over the table in the right hand screen (the tooltip appears at the far right of the first screen).

Should I be reporting these bugs on the java site or with matrox?
0
 
LVL 92

Expert Comment

by:objects
ID: 10817904
report them to sun.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11081046
PAQed, with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

623 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