-
Bug
-
Resolution: Fixed
-
P3
-
7
-
None
-
b72
-
generic
-
generic
Several Swing components, including JList and JTextPane implement methods from Scrollable interface the following way:
// JList
public boolean getScrollableTracksViewportWidth() {
if (getParent() instanceof JViewport) {
return (((JViewport)getParent()).getWidth() > getPreferredSize().width);
}
return false;
}
As you can see the return value of this method is dependent on
the type of the parent component. It makes it impossible to create a transparent wrapper component to be inserted between JViewport and its view.
We shouldn't hardcode the instanceof check of the parent and provide more flexible solution
This is improtant for JLayer, the new component to be added to JDK 7
// JList
public boolean getScrollableTracksViewportWidth() {
if (getParent() instanceof JViewport) {
return (((JViewport)getParent()).getWidth() > getPreferredSize().width);
}
return false;
}
As you can see the return value of this method is dependent on
the type of the parent component. It makes it impossible to create a transparent wrapper component to be inserted between JViewport and its view.
We shouldn't hardcode the instanceof check of the parent and provide more flexible solution
This is improtant for JLayer, the new component to be added to JDK 7
- relates to
-
JDK-6897293 Refactor the fix for #6824395
-
- Closed
-
-
JDK-6822696 Integrating JXLayer component to Swing library
-
- Resolved
-
-
JDK-6878399 public SwingUtilities.getParentViewport() is required
-
- Resolved
-