This class represents the state of a horizontal or vertical
scrollbar of a
. Objects of this class are
returned by
methods.
| Method from java.awt.ScrollPaneAdjustable Detail: |
public synchronized void addAdjustmentListener(AdjustmentListener l) {
if (l == null) {
return;
}
adjustmentListener = AWTEventMulticaster.add(adjustmentListener, l);
}
|
public synchronized AdjustmentListener[] getAdjustmentListeners() {
return (AdjustmentListener[])(AWTEventMulticaster.getListeners(
adjustmentListener,
AdjustmentListener.class));
}
Returns an array of all the adjustment listeners
registered on this ScrollPaneAdjustable. |
public int getBlockIncrement() {
return blockIncrement;
}
|
public int getMaximum() {
return maximum;
}
|
public int getMinimum() {
// XXX: This relies on setSpan always being called with 0 for
// the minimum (which is currently true).
return 0;
}
|
public int getOrientation() {
return orientation;
}
Returns the orientation of this scrollbar. |
public int getUnitIncrement() {
return unitIncrement;
}
|
public int getValue() {
return value;
}
|
public boolean getValueIsAdjusting() {
return isAdjusting;
}
Returns true if the value is in the process of changing as a
result of actions being taken by the user. |
public int getVisibleAmount() {
return visibleAmount;
}
|
public String paramString() {
return ((orientation == Adjustable.VERTICAL ? "vertical,"
:"horizontal,")
+ "[0.."+maximum+"]"
+ ",val=" + value
+ ",vis=" + visibleAmount
+ ",unit=" + unitIncrement
+ ",block=" + blockIncrement
+ ",isAdjusting=" + isAdjusting);
}
Returns a string representing the state of this scrollbar.
This method is intended to be used only for debugging purposes,
and the content and format of the returned string may vary
between implementations. The returned string may be empty but
may not be null. |
public synchronized void removeAdjustmentListener(AdjustmentListener l) {
if (l == null) {
return;
}
adjustmentListener = AWTEventMulticaster.remove(adjustmentListener, l);
}
|
public synchronized void setBlockIncrement(int b) {
blockIncrement = b;
}
|
public void setMaximum(int max) {
throw new AWTError(SCROLLPANE_ONLY);
}
This method should NOT be called by user code.
This method is public for this class to properly implement
Adjustable interface. |
public void setMinimum(int min) {
throw new AWTError(SCROLLPANE_ONLY);
}
This method should NOT be called by user code.
This method is public for this class to properly implement
Adjustable interface. |
void setSpan(int min,
int max,
int visible) {
// adjust the values to be reasonable
minimum = min;
maximum = Math.max(max, minimum + 1);
visibleAmount = Math.min(visible, maximum - minimum);
visibleAmount = Math.max(visibleAmount, 1);
blockIncrement = Math.max((int)(visible * .90), 1);
setValue(value);
}
This is called by the scrollpane itself to update the
minimum, maximum and
visible values. The scrollpane is the only one
that should be changing these since it is the source of these
values. |
public synchronized void setUnitIncrement(int u) {
if (u != unitIncrement) {
unitIncrement = u;
if (sp.peer != null) {
ScrollPanePeer peer = (ScrollPanePeer) sp.peer;
peer.setUnitIncrement(this, u);
}
}
}
|
public void setValue(int v) {
setTypedValue(v, AdjustmentEvent.TRACK);
}
Sets the value of this scrollbar to the specified value.
If the value supplied is less than the current minimum or
greater than the current maximum, then one of those values is
substituted, as appropriate. |
public void setValueIsAdjusting(boolean b) {
if (isAdjusting != b) {
isAdjusting = b;
AdjustmentEvent e =
new AdjustmentEvent(this,
AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
AdjustmentEvent.TRACK, value, b);
adjustmentListener.adjustmentValueChanged(e);
}
}
Sets the valueIsAdjusting property. |
public void setVisibleAmount(int v) {
throw new AWTError(SCROLLPANE_ONLY);
}
This method should NOT be called by user code.
This method is public for this class to properly implement
Adjustable interface. |
public String toString() {
return getClass().getName() + "[" + paramString() + "]";
}
Returns a string representation of this scrollbar and its values. |