I just stumbled over this code in JViewport.setViewPosition():

       if (view instanceof JComponent) {
           JComponent c = (JComponent)view;
           oldX = c.getX();
           oldY = c.getY();
       }
       else {
           Rectangle r = view.getBounds();
           oldX = r.x;
           oldY = r.y;
       }

I think this special casing is not necessary anymore since JDK1.2.
Attached is a patch to correct this.

Cheers, Roman

-- 
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: j2se/src/share/classes/javax/swing/JViewport.java
===================================================================
--- j2se/src/share/classes/javax/swing/JViewport.java	(Revision 252)
+++ j2se/src/share/classes/javax/swing/JViewport.java	(Arbeitskopie)
@@ -1099,16 +1099,8 @@
 	 * and do the song and dance to avoid allocating 
 	 * a Rectangle object if we don't have to.
 	 */
-	if (view instanceof JComponent) {
-	    JComponent c = (JComponent)view;
-	    oldX = c.getX();
-	    oldY = c.getY();
-	}
-	else {
-	    Rectangle r = view.getBounds();
-	    oldX = r.x;
-	    oldY = r.y;
-	}
+	oldX = view.getX();
+	oldY = view.getY();
 
 	/* The view scrolls in the opposite direction to mouse 
 	 * movement.

Reply via email to