All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.awt
Class Scrollbar

    com.sas.awt.Scrollbar

All Implemented Interfaces:
  VisualInterface, com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.PublicClonable, com.sas.ViewDefaultModelInterface, com.sas.ViewInterface, MultipleValueEventSourceInterface, java.awt.Adjustable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.accessibility.Accessible

    public class Scrollbar

implements com.sas.PublicClonable, com.sas.ViewDefaultModelInterface

Scrollbar is a component that can scroll through a range of integer values. The minimum and maximum range values can be specified during the construction of the scrollbar. If not specified, the default minimum value is 0 and the default maximum value is 100. The value is the current value and can be specified during construction. If not specified, the default value is 0. The visibleAmount is the amount that is visible of the scrollbar thumb. The visibleAmount can be specified during construction of the scrollbar. If not specified, the default visibleAmount is 10. The scrollbar can be oriented either vertically or horizontally. The orientation can be specified during the construction of the scrollbar. If not specified, the default orientation is vertical.
Creation:

1. Create a Scrollbar
   `Scrollbar scrollbar1 = new Scrollbar();`
   `scrollbar1.initialize();`
2. Create a Scrollbar with the specified orientation
   `Scrollbar scrollbar1 = new Scrollbar(orientation);`
   `scrollbar1.initialize();`
   where orientation is an integer that specifies the orientation (Scrollbar. VERTICAL or Scrollbar.HORIZONTAL)
3. Create a Scrollbar with the specified orientation, value, visibleAmount, minimum, and maximum
   `Scrollbar scrollbar1 = new Scrollbar(orientation, value, visible, minimum, maximum);`
   `scrollbar1.initialize();`
   where:
   - orientation is an integer that specifies the orientation of the scrollbar (Scrollbar.HORIZONTAL = horizontal, Scrollbar.VERTICAL = vertical)
   - value is an integer that is the current value of the scrollbar
   - visible is an integer that specifies the amount that is visible of the scrollbar thumb
   - minimum is an integer that specifies the minimum value of the scrollbar
   - maximum is an integer that specifies the maximum value of the scrollbar

Default Size:

- height = 124
- width = 16

Required Interfaces:
The Scrollbar requires a model that implements the com.sas.models.BoundedNumber interface. A default model is automatically created and attached to the scrollbar when the scrollbar is initially constructed.
Events:
The Scrollbar sends out an AdjustmentEvent when the scrollbar thumb is clicked, an arrow button is clicked, or a click occurs in the scrollbar trough.
Notes:

- Scrollbar implements the com.sas.PublicClonable interface.
- Scrollbar orientation can be changed through the setOrientation(int orientation) method. Valid values are: Scrollbar.HORIZONTAL or 0, and Scrollbar.VERTICAL or 1. Specifying any other value will result in a java.lang.IllegalArgumentException being thrown.
- Relationships Between Minimum, Maximum, Value, and VisibleAmount Properties
  1. Maximum must be greater than the minimum.
  2. Value must be greater than or equal to minimum AND less than or equal to (Maximum-VisibleAmount).
  3. VisibleAmount must be greater than one AND less than or equal to (Maximum-Minimum).
- The minimum value can be changed through the setMinimum(int) method. If the minimum is set to be greater than or equal to the maximum, a java.lang.IllegalArgumentException will be thrown.
- The maximum value can be changed through the setMaximum(int) method. If the maximum is set to be less than the minimum, a java.lang.IllegalArgumentException will be thrown.
- The value can be changed through the setValue(int) method. If the value is set to be less than the minimum, the value will be set to be equal to the minimum. If the value is set to greater than maximum-visibleAmount, the value will be set to maximum-visibleAmount.
- The visibleAmount can be changed through the setVisibleAmount(int) method. If the visibleAmount is set to be less than one, the visibleAmount will be set to one. If the visibleAmount is set to be greater than maximum- minimum, the visibleAmount will be set to maximum-minimum.
- The unitIncrement specifies the amount to be added/subtracted to the current value when an arrow button is pushed. Specifying a value less than zero or a value greater than (maximum - minimum) will result in a java.lang.IllegalArgumentException.
- The blockIncrement specifies the amount to be added/subtracted to the current value when a click occurs in the scrollbar trough. Specifying a value less than zero or a value greater than (maximum - minimum) will result in a java.lang.IllegalArgumentException.

See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `RB_KEY`

Constructor Summary
`Scrollbar()` Default constructor
`Scrollbar(int orientation)` Create a scrollbar with the specified orientation
`Scrollbar(int orientation, int value, int visible, int minimum, int maximum)` Create a scrollbar with the specified orientation, value, visibleAmount, minimum, and maximum

Method Summary
`void` | `attachModel(com.sas.ModelInterface model)` Attaches a model to the component.
`java.lang.Object` | `clone()` Clones the component
`void` | `detachModel(com.sas.ModelInterface model)` Detaches the current model and attaches the default model if the model is set to null
`static int` | `getDefaultHeight()` Returns the default height for instances of this class
`static int` | `getDefaultWidth()` Returns the default width for instances of this class
`static com.sas.beans.ExtendedBeanInfo` | `getExtendedBeanInfo()` Returns the ExtendedBeanInfo for this class.
`java.util.Vector` | `getRequiredInterfaces()` Returns the required interfaces Vector for this component.
`boolean` | `isDefaultModelAttached()` Returns whether the default model is attached.
`void` | `propertyChange(java.beans.PropertyChangeEvent event)` Processes a PropertyChangeEvent sent by the model.
`void` | `refresh(com.sas.ModelInterface model)` Sets properties (blockIncrement, maximum, minimum, unitIncrement, value and visibleAmount) with the values obtained from the attached model
`void` | `refreshBlockIncrement()` Sets the blockIncrement based on the model value for blockIncrement.
`void` | `refreshMaximum()` Sets the maximum based on the model value for maximum.
`void` | `refreshMinimum()` Sets the minimum based on the model value for minimum.
`void` | `refreshUnitIncrement()` Sets the unitIncrement based on the model value for unitIncrement.
`void` | `refreshValue()` Sets the value based on the model value.
`void` | `setBlockIncrement(int v)` Sets the block increment.
`static void` | `setDefaultHeight(int newDefaultHeight)` Sets the default height of the component.
`void` | `setDefaultValues()` Sets the initial values to the default values.
`static void` | `setDefaultWidth(int newDefaultWidth)` Sets the default width of the component.
`void` | `setMaximum(int newMaximum)` Sets the maximum value
`void` | `setMinimum(int newMinimum)` Sets the minimum value
`void` | `setOrientation(int orientation)` Sets the orientation of the Scrollbar
`void` | `setUnitIncrement(int v)` Sets the unit increment.
`void` | `setValue(int newValue)` Sets the value to the specified value.
`void` | `setValues(int value, int visible, int minimum, int maximum)` Sets the values for the Scrollbar.
`void` | `setVisibleAmount(int newAmount)` Sets the visible amount to the specified value

Methods inherited from class com.sas.awt.ScrollbarVisualComponent
`addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachView, computePreferredSize, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getBackgroundColor, getBorder, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getFont, getForegroundColor, getHeight, getHorizontalPosition, getLinkInfo, getMinimumSize, getModelInterface, getPreferredSize, getPrePainter, getVerticalPosition, getViewInterfaceSupportInfo, getVisualInterfaceSupportInfo, getWidth, initialize, initializeComponent, isDesignTime, isEnabled, isFocus, isLinked, isTransparent, isVisible, paint, queryLinks, queryLinks, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setBackgroundColor, setBorder, setBounds, setComponentDescription, setComponentSupportInfo, setEnabled, setFocus, setFont, setForegroundColor, setHeight, setHorizontalPosition, setLinkInfo, setModelInterface, setPreferredSize, setPrePainter, setRequiredInterfaces, setTransparent, setVerticalPosition, setViewInterfaceSupportInfo, setVisible, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, update, validateObject`

Field Detail

### RB_KEY

    public static final java.lang.String RB_KEY

See Also:
  Constant Field Values

Constructor Detail

### Scrollbar

    public Scrollbar()

  Default constructor

### Scrollbar

    public Scrollbar(int orientation)

  Create a scrollbar with the specified orientation

  Parameters:
    `orientation` - an integer that specifies the orientation of the scrollbar (Scrollbar.HORIZONTAL = horizontal, Scrollbar.VERTICAL = vertical)

### Scrollbar

    public Scrollbar(int orientation,
                     int value,
                     int visible,
                     int minimum,
                     int maximum)

  Create a scrollbar with the specified orientation, value, visibleAmount, minimum, and maximum

  Parameters:
    `orientation` - an integer that specifies the orientation of the scrollbar (Scrollbar.HORIZONTAL = horizontal, Scrollbar.VERTICAL = vertical)
    `value` - an integer that is the current value of the scrollbar
    `visible` - an integer that specifies the amount that is visible of the scrollbar thumb
    `minimum` - is an integer that specifies the minimum value of the scrollbar
    `maximum` - is an integer that specifies the maximum value of the scrollbar

Method Detail

### getDefaultWidth

    public static int getDefaultWidth()

  Returns the default width for instances of this class

  Returns:
    the default width in pixels
  See Also:
    `setDefaultWidth(int)`

### setDefaultWidth

    public static void setDefaultWidth(int newDefaultWidth)

  Sets the default width of the component. The default width will be used by webAF when creating this component.

  Parameters:
    `newDefaultWidth` - the new default width in pixels
  See Also:
    `getDefaultWidth()`

### getDefaultHeight

    public static int getDefaultHeight()

  Returns the default height for instances of this class

  Returns:
    the default height in pixels
  See Also:
    `setDefaultHeight(int)`

### setDefaultHeight

    public static void setDefaultHeight(int newDefaultHeight)

  Sets the default height of the component. The default height will be used by webAF when creating this component.

  Parameters:
    `newDefaultHeight` - the new default height in pixels
  See Also:
    `getDefaultHeight()`

### getExtendedBeanInfo

    public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

  Returns the ExtendedBeanInfo for this class.

  Returns:
    ExtendedBeanInfo for this class

### attachModel

    public void attachModel(com.sas.ModelInterface model)

  Attaches a model to the component. Listens for PropertyChangeEvents from the model.

  Specified by:
    `attachModel` in interface `com.sas.ViewInterface`
  Overrides:
    `attachModel` in class `ScrollbarVisualComponent`
  Parameters:
    `model` - model to attach
  See Also:
    `ViewInterface.attachModel(com.sas.ModelInterface)`

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Clones the component

  Specified by:
    `clone` in interface `com.sas.PublicClonable`
  Overrides:
    `clone` in class `ScrollbarVisualComponent`
  Returns:
    a clone of the object.
  Throws:
    `java.lang.CloneNotSupportedException` - if the model attached to the component being cloned will not allow the clone to attach.

### detachModel

    public void detachModel(com.sas.ModelInterface model)

  Detaches the current model and attaches the default model if the model is set to null

  Specified by:
    `detachModel` in interface `com.sas.ViewInterface`
  Overrides:
    `detachModel` in class `ScrollbarVisualComponent`
  Parameters:
    `model` - Model to detach
  See Also:
    `ViewInterface.detachModel(com.sas.ModelInterface)`

### getRequiredInterfaces

    public java.util.Vector getRequiredInterfaces()

  Returns the required interfaces Vector for this component.

  Specified by:
    `getRequiredInterfaces` in interface `com.sas.ViewInterface`
  Overrides:
    `getRequiredInterfaces` in class `ScrollbarVisualComponent`
  Returns:
    the required interfaces Vector for this component.
  See Also:
    `ViewInterface.getRequiredInterfaces()`

### isDefaultModelAttached

    public boolean isDefaultModelAttached()

  Returns whether the default model is attached.

  Specified by:
    `isDefaultModelAttached` in interface `com.sas.ViewDefaultModelInterface`
  Returns:
    whether the default model is attached.

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)

  Processes a PropertyChangeEvent sent by the model.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`
  Overrides:
    `propertyChange` in class `ScrollbarVisualComponent`
  Parameters:
    `event` - The event from the model indicating what property changed
  See Also:
    `PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)`

### refresh

    public void refresh(com.sas.ModelInterface model)

  Sets properties (blockIncrement, maximum, minimum, unitIncrement, value and visibleAmount) with the values obtained from the attached model

  Specified by:
    `refresh` in interface `com.sas.ViewInterface`
  Overrides:
    `refresh` in class `ScrollbarVisualComponent`
  Parameters:
    `model` - attached model
  See Also:
    `ViewInterface.refresh(com.sas.ModelInterface)`

### refreshBlockIncrement

    public void refreshBlockIncrement()

  Sets the blockIncrement based on the model value for blockIncrement.

### refreshMaximum

    public void refreshMaximum()

  Sets the maximum based on the model value for maximum.

### refreshMinimum

    public void refreshMinimum()

  Sets the minimum based on the model value for minimum.

### refreshUnitIncrement

    public void refreshUnitIncrement()

  Sets the unitIncrement based on the model value for unitIncrement.

### refreshValue

    public void refreshValue()

  Sets the value based on the model value.

### setBlockIncrement

    public void setBlockIncrement(int v)

  Sets the block increment. This is the value that will be added (subtracted) when the user clicks in the scrollbar trough

  Specified by:
    `setBlockIncrement` in interface `java.awt.Adjustable`
  Overrides:
    `setBlockIncrement` in class `java.awt.Scrollbar`
  Parameters:
    `v` - value of the block increment

### setDefaultValues

    public void setDefaultValues()

  Sets the initial values to the default values. This method is called by the Component constructors. The setDefaultValues method of each class is responsible for setting its own initial values.

  Specified by:
    `setDefaultValues` in interface `VisualInterface`
  Specified by:
    `setDefaultValues` in interface `com.sas.ComponentInterface`
  Overrides:
    `setDefaultValues` in class `ScrollbarVisualComponent`
  See Also:
    `ComponentInterface.setDefaultValues()`

### setMaximum

    public void setMaximum(int newMaximum)

  Sets the maximum value

  Specified by:
    `setMaximum` in interface `java.awt.Adjustable`
  Overrides:
    `setMaximum` in class `java.awt.Scrollbar`
  Parameters:
    `newMaximum` - maximum value

### setMinimum

    public void setMinimum(int newMinimum)

  Sets the minimum value

  Specified by:
    `setMinimum` in interface `java.awt.Adjustable`
  Overrides:
    `setMinimum` in class `java.awt.Scrollbar`
  Parameters:
    `newMinimum` - minimum value

### setOrientation

    public void setOrientation(int orientation)

  Sets the orientation of the Scrollbar

  Overrides:
    `setOrientation` in class `java.awt.Scrollbar`
  Parameters:
    `orientation` - orientation (horizontal or vertical) of the Scrollbar

### setUnitIncrement

    public void setUnitIncrement(int v)

  Sets the unit increment. This is the value that will be added (subtracted) when the user hits the arrow button.

  Specified by:
    `setUnitIncrement` in interface `java.awt.Adjustable`
  Overrides:
    `setUnitIncrement` in class `java.awt.Scrollbar`
  Parameters:
    `v` - value of the unit increment

### setValue

    public void setValue(int newValue)

  Sets the value to the specified value. If this value is below the current minimum or above the current maximum, it becomes the new one of those values, respectively.

  Specified by:
    `setValue` in interface `java.awt.Adjustable`
  Overrides:
    `setValue` in class `java.awt.Scrollbar`
  Parameters:
    `newValue` - new value of the Scrollbar.

### setValues

    public void setValues(int value,
                          int visible,
                          int minimum,
                          int maximum)

  Sets the values for the Scrollbar. This method enforces the following constraints: maximum must be greater than minimum, value must be greater than or equal to the maximum minus the visible amount, visible amount must be greater than 1 and less than or equal to the difference between the maximum and minimum values

  Overrides:
    `setValues` in class `java.awt.Scrollbar`
  Parameters:
    `value` - value
    `visible` - size of the scrollbar thumb
    `minimum` - minimum value
    `maximum` - maximum value

### setVisibleAmount

    public void setVisibleAmount(int newAmount)

  Sets the visible amount to the specified value

  Specified by:
    `setVisibleAmount` in interface `java.awt.Adjustable`
  Overrides:
    `setVisibleAmount` in class `java.awt.Scrollbar`
  Parameters:
    `newAmount` - size of the scrollbar thumb

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.