jdk/src/share/classes/javax/swing/JList.java
changeset 5449 21bec46ee9e3
parent 4378 ef21a120cb18
child 5506 202f599c92aa
--- a/jdk/src/share/classes/javax/swing/JList.java	Wed Apr 21 18:12:21 2010 +0400
+++ b/jdk/src/share/classes/javax/swing/JList.java	Thu Apr 29 18:38:25 2010 +0400
@@ -25,17 +25,7 @@
 
 package javax.swing;
 
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.GraphicsEnvironment;
-import java.awt.HeadlessException;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Rectangle;
+import java.awt.*;
 import java.awt.event.*;
 
 import java.util.Vector;
@@ -2779,9 +2769,9 @@
                                       getVisibleRowCount() <= 0) {
             return true;
         }
-        JViewport port = SwingUtilities.getParentViewport(this);
-        if (port != null) {
-            return port.getWidth() > getPreferredSize().width;
+        Container parent = SwingUtilities.getUnwrappedParent(this);
+        if (parent instanceof JViewport) {
+            return parent.getWidth() > getPreferredSize().width;
         }
         return false;
     }
@@ -2805,9 +2795,9 @@
                      getVisibleRowCount() <= 0) {
             return true;
         }
-        JViewport port = SwingUtilities.getParentViewport(this);
-        if (port != null) {
-            return port.getHeight() > getPreferredSize().height;
+        Container parent = SwingUtilities.getUnwrappedParent(this);
+        if (parent instanceof JViewport) {
+            return parent.getHeight() > getPreferredSize().height;
         }
         return false;
     }