Allow width and height tracking to be set.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@924 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2002-11-12 05:52:03 +00:00
parent 39856ea7fc
commit 62a7efa8ae
@@ -1,5 +1,5 @@
//
// $Id: ScrollablePanel.java,v 1.2 2002/02/28 16:31:11 mdb Exp $
// $Id: ScrollablePanel.java,v 1.3 2002/11/12 05:52:03 mdb Exp $
package com.samskivert.swing;
@@ -56,6 +56,24 @@ public class ScrollablePanel extends JPanel
{
}
/**
* Instructs this panel to not scroll in the horizontal direction but
* to set its viewport's horizontal size when it is sized.
*/
public void setTracksViewportWidth (boolean tracksWidth)
{
_tracksWidth = tracksWidth;
}
/**
* Instructs this panel to not scroll in the vertical direction but to
* set its viewport's vertical size when it is sized.
*/
public void setTracksViewportHeight (boolean tracksHeight)
{
_tracksHeight = tracksHeight;
}
// documentation inherited from interface
public Dimension getPreferredScrollableViewportSize ()
{
@@ -119,15 +137,18 @@ public class ScrollablePanel extends JPanel
// documentation inherited from interface
public boolean getScrollableTracksViewportWidth ()
{
return false;
return _tracksWidth;
}
// documentation inherited from interface
public boolean getScrollableTracksViewportHeight ()
{
return false;
return _tracksHeight;
}
protected boolean _tracksWidth = false;
protected boolean _tracksHeight = false;
/** The number of pixels to scroll if we can't find a component to
* scroll into view or if we're scrolling horizontally. */
protected static final int DEFAULT_SCROLL_AMOUNT = 10;