This is the update to the JTable auto-resizing patch I submitted
yesterday. This patch allows the user to disable auto-resizing by
setting JTable's autoResizeMode to AUTO_RESIZE_OFF. It also makes
ViewportLayout respect properties of Scrollable views such as the return
value of getPreferredScrollableViewportSize().
Patch is attached.
2005-09-01 Anthony Balkissoon <[EMAIL PROTECTED]>
Fixes bug #23204
* javax/swing/ViewportLayout.java:
(preferredLayoutSize): If the view is scrollable, call its
getPreferredScrollableViewportSize method.
(layoutContainer): If the view is scrollable, check its
getScrollableTracksViewportWidth and getScrollableTracksViewportHeight
methods before resizing the view to match the viewport.
--Tony
Index: javax/swing/ViewportLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/ViewportLayout.java,v
retrieving revision 1.13
diff -u -r1.13 ViewportLayout.java
--- javax/swing/ViewportLayout.java 2 Jul 2005 20:32:49 -0000 1.13
+++ javax/swing/ViewportLayout.java 1 Sep 2005 17:20:07 -0000
@@ -69,7 +69,11 @@
JViewport vp = (JViewport)parent;
Component view = vp.getView();
if (view != null)
- return view.getPreferredSize();
+ {
+ if (view instanceof Scrollable)
+ return ((Scrollable)view).getPreferredScrollableViewportSize();
+ return view.getPreferredSize();
+ }
else
return new Dimension();
}
@@ -120,7 +124,7 @@
JViewport port = (JViewport) parent;
Component view = port.getView();
-
+
if (view == null)
return;
@@ -139,7 +143,8 @@
if (portBounds.height >= viewMinimum.height)
{
portBounds.y = 0;
- viewPref.height = portBounds.height;
+ if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportHeight())
+ viewPref.height = portBounds.height;
}
else
{
@@ -153,7 +158,8 @@
if (portBounds.width >= viewMinimum.width)
{
portBounds.x = 0;
- viewPref.width = portBounds.width;
+ if ( !(view instanceof Scrollable) || ((Scrollable)view).getScrollableTracksViewportWidth())
+ viewPref.width = portBounds.width;
}
else
{
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches