< prev index next >
src/java.desktop/share/classes/java/awt/ScrollPaneAdjustable.java
Print this page
*** 32,50 ****
import java.io.Serializable;
/**
* This class represents the state of a horizontal or vertical
! * scrollbar of a <code>ScrollPane</code>. Objects of this class are
! * returned by <code>ScrollPane</code> methods.
*
* @since 1.4
*/
public class ScrollPaneAdjustable implements Adjustable, Serializable {
/**
! * The <code>ScrollPane</code> this object is a scrollbar of.
* @serial
*/
private ScrollPane sp;
/**
--- 32,50 ----
import java.io.Serializable;
/**
* This class represents the state of a horizontal or vertical
! * scrollbar of a {@code ScrollPane}. Objects of this class are
! * returned by {@code ScrollPane} methods.
*
* @since 1.4
*/
public class ScrollPaneAdjustable implements Adjustable, Serializable {
/**
! * The {@code ScrollPane} this object is a scrollbar of.
* @serial
*/
private ScrollPane sp;
/**
*** 57,114 ****
*/
private int orientation;
/**
* The value of this scrollbar.
! * <code>value</code> should be greater than <code>minimum</code>
! * and less than <code>maximum</code>
*
* @serial
* @see #getValue
* @see #setValue
*/
private int value;
/**
* The minimum value of this scrollbar.
! * This value can only be set by the <code>ScrollPane</code>.
* <p>
* <strong>ATTN:</strong> In current implementation
! * <code>minimum</code> is always <code>0</code>. This field can
! * only be altered via <code>setSpan</code> method and
! * <code>ScrollPane</code> always calls that method with
! * <code>0</code> for the minimum. <code>getMinimum</code> method
! * always returns <code>0</code> without checking this field.
*
* @serial
* @see #getMinimum
* @see #setSpan(int, int, int)
*/
private int minimum;
/**
* The maximum value of this scrollbar.
! * This value can only be set by the <code>ScrollPane</code>.
*
* @serial
* @see #getMaximum
* @see #setSpan(int, int, int)
*/
private int maximum;
/**
* The size of the visible portion of this scrollbar.
! * This value can only be set by the <code>ScrollPane</code>.
*
* @serial
* @see #getVisibleAmount
* @see #setSpan(int, int, int)
*/
private int visibleAmount;
/**
! * The adjusting status of the <code>Scrollbar</code>.
* True if the value is in the process of changing as a result of
* actions being taken by the user.
*
* @see #getValueIsAdjusting
* @see #setValueIsAdjusting
--- 57,114 ----
*/
private int orientation;
/**
* The value of this scrollbar.
! * {@code value} should be greater than {@code minimum}
! * and less than {@code maximum}
*
* @serial
* @see #getValue
* @see #setValue
*/
private int value;
/**
* The minimum value of this scrollbar.
! * This value can only be set by the {@code ScrollPane}.
* <p>
* <strong>ATTN:</strong> In current implementation
! * {@code minimum} is always {@code 0}. This field can
! * only be altered via {@code setSpan} method and
! * {@code ScrollPane} always calls that method with
! * {@code 0} for the minimum. {@code getMinimum} method
! * always returns {@code 0} without checking this field.
*
* @serial
* @see #getMinimum
* @see #setSpan(int, int, int)
*/
private int minimum;
/**
* The maximum value of this scrollbar.
! * This value can only be set by the {@code ScrollPane}.
*
* @serial
* @see #getMaximum
* @see #setSpan(int, int, int)
*/
private int maximum;
/**
* The size of the visible portion of this scrollbar.
! * This value can only be set by the {@code ScrollPane}.
*
* @serial
* @see #getVisibleAmount
* @see #setSpan(int, int, int)
*/
private int visibleAmount;
/**
! * The adjusting status of the {@code Scrollbar}.
* True if the value is in the process of changing as a result of
* actions being taken by the user.
*
* @see #getValueIsAdjusting
* @see #setValueIsAdjusting
*** 139,149 ****
private int blockIncrement = 1;
private AdjustmentListener adjustmentListener;
/**
! * Error message for <code>AWTError</code> reported when one of
* the public but unsupported methods is called.
*/
private static final String SCROLLPANE_ONLY =
"Can be set by scrollpane only";
--- 139,149 ----
private int blockIncrement = 1;
private AdjustmentListener adjustmentListener;
/**
! * Error message for {@code AWTError} reported when one of
* the public but unsupported methods is called.
*/
private static final String SCROLLPANE_ONLY =
"Can be set by scrollpane only";
*** 172,199 ****
private static final long serialVersionUID = -3359745691033257079L;
/**
* Constructs a new object to represent specified scrollabar
! * of the specified <code>ScrollPane</code>.
* Only ScrollPane creates instances of this class.
! * @param sp <code>ScrollPane</code>
! * @param l <code>AdjustmentListener</code> to add upon creation.
* @param orientation specifies which scrollbar this object represents,
! * can be either <code>Adjustable.HORIZONTAL</code>
! * or <code>Adjustable.VERTICAL</code>.
*/
ScrollPaneAdjustable(ScrollPane sp, AdjustmentListener l, int orientation) {
this.sp = sp;
this.orientation = orientation;
addAdjustmentListener(l);
}
/**
* This is called by the scrollpane itself to update the
! * <code>minimum</code>, <code>maximum</code> and
! * <code>visible</code> values. The scrollpane is the only one
* that should be changing these since it is the source of these
* values.
*/
void setSpan(int min, int max, int visible) {
// adjust the values to be reasonable
--- 172,199 ----
private static final long serialVersionUID = -3359745691033257079L;
/**
* Constructs a new object to represent specified scrollabar
! * of the specified {@code ScrollPane}.
* Only ScrollPane creates instances of this class.
! * @param sp {@code ScrollPane}
! * @param l {@code AdjustmentListener} to add upon creation.
* @param orientation specifies which scrollbar this object represents,
! * can be either {@code Adjustable.HORIZONTAL}
! * or {@code Adjustable.VERTICAL}.
*/
ScrollPaneAdjustable(ScrollPane sp, AdjustmentListener l, int orientation) {
this.sp = sp;
this.orientation = orientation;
addAdjustmentListener(l);
}
/**
* This is called by the scrollpane itself to update the
! * {@code minimum}, {@code maximum} and
! * {@code visible} values. The scrollpane is the only one
* that should be changing these since it is the source of these
* values.
*/
void setSpan(int min, int max, int visible) {
// adjust the values to be reasonable
*** 206,226 ****
}
/**
* Returns the orientation of this scrollbar.
* @return the orientation of this scrollbar, either
! * <code>Adjustable.HORIZONTAL</code> or
! * <code>Adjustable.VERTICAL</code>
*/
public int getOrientation() {
return orientation;
}
/**
* This method should <strong>NOT</strong> be called by user code.
* This method is public for this class to properly implement
! * <code>Adjustable</code> interface.
*
* @throws AWTError Always throws an error when called.
*/
public void setMinimum(int min) {
throw new AWTError(SCROLLPANE_ONLY);
--- 206,226 ----
}
/**
* Returns the orientation of this scrollbar.
* @return the orientation of this scrollbar, either
! * {@code Adjustable.HORIZONTAL} or
! * {@code Adjustable.VERTICAL}
*/
public int getOrientation() {
return orientation;
}
/**
* This method should <strong>NOT</strong> be called by user code.
* This method is public for this class to properly implement
! * {@code Adjustable} interface.
*
* @throws AWTError Always throws an error when called.
*/
public void setMinimum(int min) {
throw new AWTError(SCROLLPANE_ONLY);
*** 233,243 ****
}
/**
* This method should <strong>NOT</strong> be called by user code.
* This method is public for this class to properly implement
! * <code>Adjustable</code> interface.
*
* @throws AWTError Always throws an error when called.
*/
public void setMaximum(int max) {
throw new AWTError(SCROLLPANE_ONLY);
--- 233,243 ----
}
/**
* This method should <strong>NOT</strong> be called by user code.
* This method is public for this class to properly implement
! * {@code Adjustable} interface.
*
* @throws AWTError Always throws an error when called.
*/
public void setMaximum(int max) {
throw new AWTError(SCROLLPANE_ONLY);
*** 270,280 ****
}
/**
* This method should <strong>NOT</strong> be called by user code.
* This method is public for this class to properly implement
! * <code>Adjustable</code> interface.
*
* @throws AWTError Always throws an error when called.
*/
public void setVisibleAmount(int v) {
throw new AWTError(SCROLLPANE_ONLY);
--- 270,280 ----
}
/**
* This method should <strong>NOT</strong> be called by user code.
* This method is public for this class to properly implement
! * {@code Adjustable} interface.
*
* @throws AWTError Always throws an error when called.
*/
public void setVisibleAmount(int v) {
throw new AWTError(SCROLLPANE_ONLY);
*** 284,294 ****
return visibleAmount;
}
/**
! * Sets the <code>valueIsAdjusting</code> property.
*
* @param b new adjustment-in-progress status
* @see #getValueIsAdjusting
* @since 1.4
*/
--- 284,294 ----
return visibleAmount;
}
/**
! * Sets the {@code valueIsAdjusting} property.
*
* @param b new adjustment-in-progress status
* @see #getValueIsAdjusting
* @since 1.4
*/
*** 305,315 ****
/**
* Returns true if the value is in the process of changing as a
* result of actions being taken by the user.
*
! * @return the value of the <code>valueIsAdjusting</code> property
* @see #setValueIsAdjusting
*/
public boolean getValueIsAdjusting() {
return isAdjusting;
}
--- 305,315 ----
/**
* Returns true if the value is in the process of changing as a
* result of actions being taken by the user.
*
! * @return the value of the {@code valueIsAdjusting} property
* @see #setValueIsAdjusting
*/
public boolean getValueIsAdjusting() {
return isAdjusting;
}
*** 359,370 ****
return value;
}
/**
* Adds the specified adjustment listener to receive adjustment
! * events from this <code>ScrollPaneAdjustable</code>.
! * If <code>l</code> is <code>null</code>, no exception is thrown
* and no action is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param l the adjustment listener.
--- 359,370 ----
return value;
}
/**
* Adds the specified adjustment listener to receive adjustment
! * events from this {@code ScrollPaneAdjustable}.
! * If {@code l} is {@code null}, no exception is thrown
* and no action is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param l the adjustment listener.
*** 380,391 ****
adjustmentListener = AWTEventMulticaster.add(adjustmentListener, l);
}
/**
* Removes the specified adjustment listener so that it no longer
! * receives adjustment events from this <code>ScrollPaneAdjustable</code>.
! * If <code>l</code> is <code>null</code>, no exception is thrown
* and no action is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param l the adjustment listener.
--- 380,391 ----
adjustmentListener = AWTEventMulticaster.add(adjustmentListener, l);
}
/**
* Removes the specified adjustment listener so that it no longer
! * receives adjustment events from this {@code ScrollPaneAdjustable}.
! * If {@code l} is {@code null}, no exception is thrown
* and no action is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param l the adjustment listener.
*** 402,415 ****
adjustmentListener = AWTEventMulticaster.remove(adjustmentListener, l);
}
/**
* Returns an array of all the adjustment listeners
! * registered on this <code>ScrollPaneAdjustable</code>.
*
! * @return all of this <code>ScrollPaneAdjustable</code>'s
! * <code>AdjustmentListener</code>s
* or an empty array if no adjustment
* listeners are currently registered
*
* @see #addAdjustmentListener
* @see #removeAdjustmentListener
--- 402,415 ----
adjustmentListener = AWTEventMulticaster.remove(adjustmentListener, l);
}
/**
* Returns an array of all the adjustment listeners
! * registered on this {@code ScrollPaneAdjustable}.
*
! * @return all of this {@code ScrollPaneAdjustable}'s
! * {@code AdjustmentListener}s
* or an empty array if no adjustment
* listeners are currently registered
*
* @see #addAdjustmentListener
* @see #removeAdjustmentListener
*** 433,443 ****
/**
* 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 <code>null</code>.
*
* @return the parameter string of this scrollbar.
*/
public String paramString() {
return ((orientation == Adjustable.VERTICAL ? "vertical,"
--- 433,443 ----
/**
* 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 {@code null}.
*
* @return the parameter string of this scrollbar.
*/
public String paramString() {
return ((orientation == Adjustable.VERTICAL ? "vertical,"
< prev index next >