--- a/jdk/src/share/classes/javax/swing/JList.java Mon Aug 24 18:21:47 2009 +0400
+++ b/jdk/src/share/classes/javax/swing/JList.java Mon Aug 24 19:22:38 2009 +0400
@@ -2722,8 +2722,9 @@
getVisibleRowCount() <= 0) {
return true;
}
- if (getParent() instanceof JViewport) {
- return (getParent().getWidth() > getPreferredSize().width);
+ JViewport port = SwingUtilities2.getViewport(this);
+ if (port != null) {
+ return port.getWidth() > getPreferredSize().width;
}
return false;
}
@@ -2747,8 +2748,9 @@
getVisibleRowCount() <= 0) {
return true;
}
- if (getParent() instanceof JViewport) {
- return (getParent().getHeight() > getPreferredSize().height);
+ JViewport port = SwingUtilities2.getViewport(this);
+ if (port != null) {
+ return port.getHeight() > getPreferredSize().height;
}
return false;
}