Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

JScrollPane painting problem with multiple screens

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
amswain
Asked:
amswain
  • 3
  • 2
  • 2
  • +2
1 Solution
 
Mayank SAssociate Director - Product EngineeringCommented:
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
 
amswainAuthor Commented:
a) No effect (and why would it)?  b) It's only a test program and I'm a lazy typist.
0
 
amswainAuthor Commented:
BTW, I have also tried running with
-Dsun.java2d.ddlock=true and
-Dsun.java2d.noddraw=true
with no improvement
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Mayank SAssociate Director - Product EngineeringCommented:
>>  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
 
GrandSchtroumpfCommented:
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
 
objectsCommented:
Sounds like potentially a java bug with that card.
0
 
amswainAuthor Commented:
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
 
objectsCommented:
report them to sun.
0
 
moduloCommented:
PAQed, with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now