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.swing.visuals
Class SpinButton

    com.sas.swing.visuals.SpinButton

All Implemented Interfaces:
  com.sas.models.IncrementInterface, ViewDefaultModel, AlarmListener, java.awt.Adjustable, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

    public class SpinButton

implements java.awt.Adjustable, AlarmListener, java.beans.PropertyChangeListener, com.sas.models.IncrementInterface, java.awt.event.MouseListener, java.awt.event.KeyListener, ViewDefaultModel

SpinButton is a class that creates a component with two opposing arrow buttons that can be pressed to increment or decrement a value field.

Creating a SpinButton Component

A valid instance is created by instantiating an object of SpinButton from one of the two constructors.

     // Default Constructor
     SpinButton spinButton1 = new SpinButton();
     // Sets the initial values
     SpinButton spinButton2 = new SpinButton( initialValue, minimum, maximum, unitIncrement, blockIncrement, orientation );

Usage

Setting up a Model

The SpinButton component uses a model that implements the com.sas.models.BoundedNumberInterface. A default model of BoundedLong is created and attached in setDefaultValues(). To dettach the model call setModel(null).

Range

The range of the SpinButton can be set using the setMinium(int) and setMaximum(int) methods. The SpinButton value will increment/decrement to the minimum and maximum values, inclusively. A click of the increment or decrement button will change the value by the unitIncrement amount.

Orientation

The SpinButton arrows can be positioned either horizontally or vertically based on the orientation of the SpinButton. If the arrows are oriented horizontally the increment button is the right arrow and the decrement is the left arrow. If the arrows are oriented vertically the increment button is the top arrow and the decrement button is the bottom arrow. The functions of the buttons can be swapped by calling swapButtonFunctions().

Cycle

The SpinButton can be set to allow the value to cycle from minimum to maximum and back to minimum.

Alarm

An Alarm object can be set on the SpinButton to cause the buttons to increment everytime the alarm is fired while a button is held down. The start delay of the alarm allows time for a user to press and release the button without starting the alarm. Once the alarm is started, the interval used to fire the alarm is decremented by 100ms every time the alarm fires, to speed up the firing rate of the alarm, until the interval is less than or equal to 100ms.

Handling Events

The SpinButton sends out java.beans.PropertyChangeEvent events for all of its properties and also sends out java.awt.event.AdjustmentEvent events when the value is changed.
Notes:

- If the setOrientation method is called after the buttons have been swapped the buttons will be back in their default positions for the respective orientation that they were set to. Another call to swapButtonFunction() is required to swap the buttons back to their previous state before the setOrientation call.

See Also:
  `SpinBox`, `BoundedLong`, `BoundedDouble`, `BoundedNumberInterface`, Serialized Form

Field Summary
`protected ArrowIcon` | `decrementArrow`
`protected javax.swing.JButton` | `decrementButton`
`protected com.sas.models.BoundedNumberInterface` | `defaultRangeModel` the default range model for the spin button
`protected long` | `delay`
`protected ArrowIcon` | `incrementArrow`
`protected javax.swing.JButton` | `incrementButton`
`static int` | `LEFT_RIGHT` int values representing the orientation of the spinButton- LEFT_RIGHT
`protected com.sas.models.BoundedNumberInterface` | `spinButtonModel`
`protected long` | `startInterval`
`static int` | `UP_DOWN` int values representing the orientation of the spinButton- UP_DOWN
`protected Alarm` | `valueChangeAlarm`

Constructor Summary
`SpinButton()` Default constructor.
`SpinButton(int value, int min, int max, int unit, int block, int orient)` Constructor taking all the neccessary variables needed to create a spinButton.

Method Summary
`void` | `addAdjustmentListener(java.awt.event.AdjustmentListener l)` Add a listener to receive adjustment events when the value of the SpinButton changes.
`protected void` | `checkEnabled()` Check if the buttons should be enabled or disabled based on the value and the maximum and the minimum.
`java.awt.Dimension` | `computePreferredSize()` Get the preferredSize of the RadioButton.
`void` | `fireAlarm(AlarmEvent evt)` Invoked when a AlarmEvent is fired by the alarm.
`Alarm` | `getAlarm()` Deprecated.
`int` | `getArrowDirection()` Get the direction the arrows are pointing.
`int` | `getBlockIncrement()` Get the integer value of the blockIncrement property.
`java.lang.Number` | `getBlockIncrementNumber()` Get the blockIncrement number based on the model.
`int` | `getButtonGap()` Get the pixel value of the `buttonGap` property.
`static int` | `getDefaultHeight()` Returns the default height in pixels
`static int` | `getDefaultWidth()` Returns the default width in pixels
`long` | `getDelay()` Get the delay before the alarm begins sending AlarmEvents.
`static com.sas.beans.ExtendedBeanInfo` | `getExtendedBeanInfo()` Returns information used by the `com.sas.beans.Introspector` to augment the automatically introspected information about a SpinButton.
`int` | `getMaximum()` Get the value of the maximum property.
`java.lang.Number` | `getMaximumNumber()` Get the maximum bounds number based on the model.
`int` | `getMinimum()` Get the value of the minimum property.
`java.lang.Number` | `getMinimumNumber()` Get the minimum bounds number based on the model.
`java.awt.Dimension` | `getMinimumSize()` Get the preferredSize of the RadioButton.
`com.sas.models.BoundedNumberInterface` | `getModel()` Returns the BoundedNumberInterface model that is set on the spinButton.
`java.lang.Number` | `getNumberValue()` Get the value number based on the model.
`int` | `getOrientation()` Get the value of the orientation property.
`java.awt.Dimension` | `getPreferredSize()` Get the preferredSize of the RadioButton.
`java.util.Vector` | `getRequiredInterfaces()` Returns the required interfaces Vector for this component.
`long` | `getStartInterval()` Get the start interval for the alarm.
`int` | `getUnitIncrement()` Get the value of the `unitIncrement` property.
`java.lang.Number` | `getUnitIncrementNumber()` Get the unitIncrement number based on the model.
`int` | `getValue()` Get the integer value of the value property.
`int` | `getVisibleAmount()` NOT USED, only here to satisfy Adjustable interface and alway returns 0
`java.lang.Number` | `incrementBy(int increment, int incrementType)` Increment, by unit or block increment amount, the current value by the specified number of increments.
`boolean` | `isCycleOn()` Indicates whether the spinButton value is cycled to the opposite bound when the increment exceeds the bounds.
`boolean` | `isDecrementEnabled()` Get the enabled state of the button that decrements the value.
`boolean` | `isDefaultModelAttached()` Returns true if the default model is being used, false otherwise.
`boolean` | `isIncrementEnabled()` Get the enabled state of the button that increments the value.
`void` | `keyPressed(java.awt.event.KeyEvent e)` Process the key pressed event on one of the buttons.
`void` | `keyReleased(java.awt.event.KeyEvent e)` Process the key being released on one of the buttons.
`void` | `keyTyped(java.awt.event.KeyEvent e)` Process any key typed events down on the buttons.
`void` | `mouseClicked(java.awt.event.MouseEvent e)` Process any mouse click events down on the buttons.
`void` | `mouseEntered(java.awt.event.MouseEvent e)` Process the mouse entering event.
`void` | `mouseExited(java.awt.event.MouseEvent e)` Process the mouse exiting event.
`void` | `mousePressed(java.awt.event.MouseEvent e)` Process the mouse pressed event on one of the buttons.
`void` | `mouseReleased(java.awt.event.MouseEvent e)` Process the mouse being released on one of the buttons.
`void` | `paintComponent(java.awt.Graphics g)` Paint the SpinButton.
`protected void` | `processAdjustmentEvent(java.awt.event.AdjustmentEvent e)` Process adjustment events.
`protected void` | `processEvent(java.awt.AWTEvent e)` Process events.
`void` | `propertyChange(java.beans.PropertyChangeEvent event)` Invoked when a bound property is changed.
`void` | `refresh(com.sas.ModelInterface model)` Refresh the spinButton based on its model.
`void` | `removeAdjustmentListener(java.awt.event.AdjustmentListener l)` Remove the adjustment listener.
`void` | `setAlarm(Alarm alarm)` Deprecated.
`void` | `setArrowDirection(int d)` Sets the direction the arrows are pointing.
`void` | `setBlockIncrement(int block)` Sets the integer value of the blockIncrement property.
`void` | `setBlockIncrementNumber(java.lang.Number block)` Sets the blockIncrement number.
`void` | `setBounds(int x, int y, int width, int height)` Call super.setBounds() and then repaint the entire component.
`void` | `setButtonGap(int gap)` Sets the pixel value of the gap between the arrow buttons.
`void` | `setCycleOn(boolean cycle)` Sets the SpinButton to cycle the value to the opposite bound when the bounds are reached.
`void` | `setDecrementEnabled(boolean decrEnabled)` Sets the decrement button enabled.
`static void` | `setDefaultHeight(int newHeight)` Sets the default height in pixels
`void` | `setDefaultValues()` Sets the initial values to the default values.
`static void` | `setDefaultWidth(int newWidth)` Sets the default width in pixels
`void` | `setDelay(long d)` Sets the delay before the alarm begins sending AlarmEvents.
`void` | `setEnabled(boolean enabled)` Sets the SpinButton enabled for user input.
`void` | `setIncrementEnabled(boolean incrEnabled)` Sets the increment button enabled.
`void` | `setMaximum(int max)` Sets the integer value of the maximum bounds.
`void` | `setMaximumNumber(java.lang.Number max)` Sets the maximum bounds number.
`void` | `setMinimum(int min)` Sets the integer value of the minimum property.
`void` | `setMinimumNumber(java.lang.Number min)` Sets the minimum bounds number.
`void` | `setModel(com.sas.models.BoundedNumberInterface model)` Sets the BoundedNUmberInterface model on the spinButton.
`void` | `setNumberValue(java.lang.Number newValue)` Sets the number value.
`void` | `setOrientation(int orient)` Sets the value of the orientation property, which determines the orientation of the SpinButton arrow buttons.
`void` | `setStartInterval(long interval)` Sets the start interval for the alarm in milliseconds.
`void` | `setToolTipText(java.lang.String text)` Registers the text to display in a tool tip.
`void` | `setUnitIncrement(int unit)` Sets the integer value of the unitIncrement for the SpinButton.
`void` | `setUnitIncrementNumber(java.lang.Number unit)` Sets the unitIncrement number.
`void` | `setValue(int newValue)` Sets the integer value of the value property.
`void` | `setVisibleAmount(int amount)` NOT USED, only here to satisfy Adjustable interface.
`void` | `stopAdjusting()` Used to stop any incrementing or decrementing that is occurring on the spinButton.
`int` | `swapButtonFunction()` Swaps the increment and decrement buttons, so if the incrementer was the Top or Left button, it is now the Bottom or Right button.

Field Detail

### valueChangeAlarm

    protected Alarm valueChangeAlarm

### startInterval

    protected long startInterval

### delay

    protected long delay

### incrementButton

    protected javax.swing.JButton incrementButton

### decrementButton

    protected javax.swing.JButton decrementButton

### incrementArrow

    protected ArrowIcon incrementArrow

### decrementArrow

    protected ArrowIcon decrementArrow

### defaultRangeModel

    protected com.sas.models.BoundedNumberInterface defaultRangeModel

  the default range model for the spin button

### spinButtonModel

    protected com.sas.models.BoundedNumberInterface spinButtonModel

### UP_DOWN

    public static final int UP_DOWN

  int values representing the orientation of the spinButton- UP_DOWN

  See Also:
    Constant Field Values

### LEFT_RIGHT

    public static final int LEFT_RIGHT

  int values representing the orientation of the spinButton- LEFT_RIGHT

  See Also:
    Constant Field Values

Constructor Detail

### SpinButton

    public SpinButton()

  Default constructor.

### SpinButton

    public SpinButton(int value,
                      int min,
                      int max,
                      int unit,
                      int block,
                      int orient)

  Constructor taking all the neccessary variables needed to create a spinButton.

  Parameters:
    `value` - the current value within the range
    `min` - the minimum value
    `max` - the maximum value
    `unit` - the unit increment
    `block` - the block increment
    `orient` - the orientation of the SpinButton arrow Buttons.

Method Detail

### getExtendedBeanInfo

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

  Returns information used by the `com.sas.beans.Introspector` to augment the automatically introspected information about a SpinButton.

  Returns:
    the ExtendedBeanInfo for this class

### getDefaultHeight

    public static int getDefaultHeight()

  Returns the default height in pixels

  Returns:
    pixel value of the default height
  See Also:
    `setDefaultHeight(int)`

### getDefaultWidth

    public static int getDefaultWidth()

  Returns the default width in pixels

  Returns:
    pixel value of default width
  See Also:
    `setDefaultWidth(int)`

### setDefaultHeight

    public static void setDefaultHeight(int newHeight)

  Sets the default height in pixels

  Parameters:
    `newHeight` - - the desired default height in pixels
  See Also:
    `getDefaultHeight()`

### setDefaultWidth

    public static void setDefaultWidth(int newWidth)

  Sets the default width in pixels

  Parameters:
    `newWidth` - - the desired default width in pixels
  See Also:
    `setDefaultWidth(int)`

### setToolTipText

    public void setToolTipText(java.lang.String text)

  Registers the text to display in a tool tip. The text displays when the cursor lingers over the spinButton for a set time period.

  Overrides:
    `setToolTipText` in class `javax.swing.JComponent`
  Parameters:
    `text` - the string to display; if the text is null, the tool tip is turned off for this component

### addAdjustmentListener

    public void addAdjustmentListener(java.awt.event.AdjustmentListener l)

  Add a listener to receive adjustment events when the value of the SpinButton changes.

  Specified by:
    `addAdjustmentListener` in interface `java.awt.Adjustable`
  Parameters:
    `l` - the adjustment listener
  See Also:
    `Adjustable.addAdjustmentListener(java.awt.event.AdjustmentListener)`, `AdjustmentEvent`

### removeAdjustmentListener

    public void removeAdjustmentListener(java.awt.event.AdjustmentListener l)

  Remove the adjustment listener.

  Specified by:
    `removeAdjustmentListener` in interface `java.awt.Adjustable`
  Parameters:
    `l` - the adjustment listener
  See Also:
    `addAdjustmentListener(java.awt.event.AdjustmentListener)`, `AdjustmentEvent`

### checkEnabled

    protected void checkEnabled()

  Check if the buttons should be enabled or disabled based on the value and the maximum and the minimum. Nothing is disabled if cycleValue is on. The incrementor is disabled when the value equals the maximum and the decrementor is disabled when the value equals the minimum.

### computePreferredSize

    public java.awt.Dimension computePreferredSize()

  Get the preferredSize of the RadioButton.

  Returns:
    the minimumSize if no resizing has been done, otherwise the current size.

### fireAlarm

    public void fireAlarm(AlarmEvent evt)

  Invoked when a AlarmEvent is fired by the alarm. The alarm is started any time the SpinButton is held down.

  Specified by:
    `fireAlarm` in interface `AlarmListener`
  Parameters:
    `evt` - the AlarmEvent fired

### getAlarm

    public Alarm getAlarm()

  Deprecated.

  Get the Alarm used to trigger events when the SpinButton is pressed.

  Returns:
    the alarm that triggers the events when the SpinButton is held.
  See Also:
    `setAlarm(com.sas.util.Alarm)`

### getArrowDirection

    public int getArrowDirection()

  Get the direction the arrows are pointing.

  Returns:
    the UP_DOWN or the LEFT_RIGHT values.
  See Also:
    `setArrowDirection(int)`

### getBlockIncrement

    public final int getBlockIncrement()

  Get the integer value of the blockIncrement property. This method calls getBlockIncrementNumber() and returns the intValue().

  Specified by:
    `getBlockIncrement` in interface `java.awt.Adjustable`
  Returns:
    the value of the blockIncrement property.
  See Also:
    `setBlockIncrement(int)`

### getButtonGap

    public int getButtonGap()

  Get the pixel value of the `buttonGap` property. The gap in pixel specifies the amount of space between the two arrow buttons.

  Returns:
    the value of the buttonGap property.
  See Also:
    `setButtonGap(int)`

### getDelay

    public long getDelay()

  Get the delay before the alarm begins sending AlarmEvents. The delay is in milliseconds.

  Returns:
    the milliseconds to delay firing the alarm.
  See Also:
    `setDelay(long)`

### getMaximum

    public final int getMaximum()

  Get the value of the maximum property. This method calls getMaximumNumber() and returns intValue(). The value is based on the model attached to the spin button

  Specified by:
    `getMaximum` in interface `java.awt.Adjustable`
  Returns:
    the value of the maximum property.
  See Also:
    `setMaximum(int)`

### getMinimum

    public final int getMinimum()

  Get the value of the minimum property. This method calls getMinimumNumber() and returns intValue(). The value is based on the model attached to the spin button

  Specified by:
    `getMinimum` in interface `java.awt.Adjustable`
  Returns:
    the value of the minimum property.
  See Also:
    `setMinimum(int)`

### getOrientation

    public int getOrientation()

  Get the value of the orientation property.

  Specified by:
    `getOrientation` in interface `java.awt.Adjustable`
  Returns:
    the value of the orientation property.
  See Also:
    `Adjustable`, `setOrientation(int)`

### getRequiredInterfaces

    public java.util.Vector getRequiredInterfaces()

  Returns the required interfaces Vector for this component.

  Returns:
    the required interfaces Vector for this component.
  See Also:
    `ViewInterface.getRequiredInterfaces()`

### getPreferredSize

    public java.awt.Dimension getPreferredSize()

  Get the preferredSize of the RadioButton.

  Overrides:
    `getPreferredSize` in class `javax.swing.JComponent`
  Returns:
    the minimumSize if no resizing has been done, otherwise the current size.

### getMinimumSize

    public java.awt.Dimension getMinimumSize()

  Get the preferredSize of the RadioButton.

  Overrides:
    `getMinimumSize` in class `javax.swing.JComponent`
  Returns:
    the minimumSize if no resizing has been done, otherwise the current size.

### getStartInterval

    public long getStartInterval()

  Get the start interval for the alarm. The alarm interval gets shorter the longer the alarm is fired( the longer the button is held down).

  Returns:
    the start interval for the alarm.
  See Also:
    `setStartInterval(long)`

### getUnitIncrement

    public final int getUnitIncrement()

  Get the value of the `unitIncrement` property. This specifies how much the value in the spin button will be incremented every time the up or down arrows are pressed. This method calls getUnitIncrementNumber() and returns intValue().

  Specified by:
    `getUnitIncrement` in interface `java.awt.Adjustable`
  Returns:
    the value of the unitIncrement property.
  See Also:
    `setUnitIncrement(int)`

### getValue

    public final int getValue()

  Get the integer value of the value property. This method calls getNumberValue() and returns intValue().

  Specified by:
    `getValue` in interface `java.awt.Adjustable`
  Returns:
    the value of the value property, 0 if there is no value.
  See Also:
    `setValue(int)`

### getVisibleAmount

    public int getVisibleAmount()

  NOT USED, only here to satisfy Adjustable interface and alway returns 0

  Specified by:
    `getVisibleAmount` in interface `java.awt.Adjustable`

### isCycleOn

    public boolean isCycleOn()

  Indicates whether the spinButton value is cycled to the opposite bound when the increment exceeds the bounds.

  Returns:
    true if the spinButton value will cycle from max to min when it reaches the max or min to max when it reaches the min.

### isDecrementEnabled

    public boolean isDecrementEnabled()

  Get the enabled state of the button that decrements the value.

  Returns:
    false, if the decrement button is grayed and doesn't respond to user input.

### isIncrementEnabled

    public boolean isIncrementEnabled()

  Get the enabled state of the button that increments the value.

  Returns:
    false, if the increment button is grayed and doesn't respond to user input.

### incrementBy

    public java.lang.Number incrementBy(int increment,
                                        int incrementType)

  Increment, by unit or block increment amount, the current value by the specified number of increments. The current value will be incremented( or decremented ) within the bounds of the maximum and minimum values.

  Specified by:
    `incrementBy` in interface `com.sas.models.IncrementInterface`
  Parameters:
    `increment` - The number of incrementType(unit or block) amounts to increment the current value(can be negative to decrement value).
    `incrementType` - UNIT to increment by the unit amount; BLOCK to increment by the block amount

### paintComponent

    public void paintComponent(java.awt.Graphics g)

  Paint the SpinButton.

  Overrides:
    `paintComponent` in class `javax.swing.JComponent`
  Parameters:
    `g` - the graphics context

### stopAdjusting

    public void stopAdjusting()

  Used to stop any incrementing or decrementing that is occurring on the spinButton. Method is mainly a convenience method to allow the user to stop adjustments when doing error handling or validation.

### processEvent

    protected void processEvent(java.awt.AWTEvent e)

  Process events.

  Overrides:
    `processEvent` in class `java.awt.Container`
  Parameters:
    `e` - the awt event that has changed

### processAdjustmentEvent

    protected void processAdjustmentEvent(java.awt.event.AdjustmentEvent e)

  Process adjustment events.

  Parameters:
    `e` - the adjustment event that has changed

### mouseClicked

    public void mouseClicked(java.awt.event.MouseEvent e)

  Process any mouse click events down on the buttons. Does not do anything.

  Specified by:
    `mouseClicked` in interface `java.awt.event.MouseListener`
  Parameters:
    `e` - the mouse clicked event

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent e)

  Process the mouse entering event.

  Specified by:
    `mouseEntered` in interface `java.awt.event.MouseListener`
  Parameters:
    `e` - the mouse entered event

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent e)

  Process the mouse exiting event. Stops all incrementing of the spinButtons. Resets the alarm.

  Specified by:
    `mouseExited` in interface `java.awt.event.MouseListener`
  Parameters:
    `the` - mouse exiting event

### mousePressed

    public void mousePressed(java.awt.event.MouseEvent e)

  Process the mouse pressed event on one of the buttons. Either increment or decrement the value and start the alarm.

  Specified by:
    `mousePressed` in interface `java.awt.event.MouseListener`
  Parameters:
    `e` - the mouse pressed event on one of the buttons

### mouseReleased

    public void mouseReleased(java.awt.event.MouseEvent e)

  Process the mouse being released on one of the buttons. This stops the alarm and incrementing/decrementing of the value.

  Specified by:
    `mouseReleased` in interface `java.awt.event.MouseListener`
  Parameters:
    `the` - mouse released event on one of the buttons

### keyTyped

    public void keyTyped(java.awt.event.KeyEvent e)

  Process any key typed events down on the buttons. Does not do anything.

  Specified by:
    `keyTyped` in interface `java.awt.event.KeyListener`
  Parameters:
    `e` - the key typed event

### keyPressed

    public void keyPressed(java.awt.event.KeyEvent e)

  Process the key pressed event on one of the buttons. Either increment or decrement the value and start the alarm.

  Specified by:
    `keyPressed` in interface `java.awt.event.KeyListener`
  Parameters:
    `e` - the key pressed event on one of the buttons

### keyReleased

    public void keyReleased(java.awt.event.KeyEvent e)

  Process the key being released on one of the buttons. This stops the alarm and incrementing/decrementing of the value.

  Specified by:
    `keyReleased` in interface `java.awt.event.KeyListener`
  Parameters:
    `the` - key released event on one of the buttons

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)

  Invoked when a bound property is changed.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`
  Parameters:
    `event` - the property event that has changed

### isDefaultModelAttached

    public boolean isDefaultModelAttached()

  Returns true if the default model is being used, false otherwise.

  Specified by:
    `isDefaultModelAttached` in interface `ViewDefaultModel`
  Returns:
    true if the default model is being used, false otherwise.
  See Also:
    `ViewDefaultModel`

### getModel

    public com.sas.models.BoundedNumberInterface getModel()

  Returns the BoundedNumberInterface model that is set on the spinButton.

  Returns:
    The model, null if no model is set.

### setModel

    public void setModel(com.sas.models.BoundedNumberInterface model)

  Sets the BoundedNUmberInterface model on the spinButton. Pass in null to dettach the model.

  Parameters:
    `the` - model to set on the spinButton, null to dettach the model

### refresh

    public void refresh(com.sas.ModelInterface model)

  Refresh the spinButton based on its model.

  Parameters:
    `model` - the ModelInterface that has changed and need to be refreshed

### setArrowDirection

    public void setArrowDirection(int d)

  Sets the direction the arrows are pointing.

  Parameters:
    `d` - the UP_DOWN or the LEFT_RIGHT values.
  See Also:
    `getArrowDirection()`

### setBlockIncrement

    public final void setBlockIncrement(int block)

  Sets the integer value of the blockIncrement property. This method calls getBlockIncrementNumber() and returns intValue().

  Specified by:
    `setBlockIncrement` in interface `java.awt.Adjustable`
  Parameters:
    `blockIncrement` - the new value of the blockIncrement property.
  See Also:
    `getBlockIncrement()`

### setBounds

    public void setBounds(int x,
                          int y,
                          int width,
                          int height)

  Call super.setBounds() and then repaint the entire component.

  Overrides:
    `setBounds` in class `java.awt.Component`
  See Also:
    `ComponentVisualComponent.setBounds(int, int, int, int)`

### setButtonGap

    public void setButtonGap(int gap)

  Sets the pixel value of the gap between the arrow buttons.

  Parameters:
    `gap` - the pixel gap between the arrow buttons
  See Also:
    `getButtonGap()`

### setCycleOn

    public void setCycleOn(boolean cycle)

  Sets the SpinButton to cycle the value to the opposite bound when the bounds are reached.

  Parameters:
    `cycle` - if the cycle is on

### setDecrementEnabled

    public void setDecrementEnabled(boolean decrEnabled)

  Sets the decrement button enabled.

  Parameters:
    `decrEnabled` - if true, the decrement button will be enabled; otherwise it will be grayed and disabled to user input.

### setDefaultValues

    public void setDefaultValues()

  Sets the initial values to the default values.

### setAlarm

    public void setAlarm(Alarm alarm)

  Deprecated.

  Sets the alarm used to trigger increments or decrements when the increment or decrement button is held down. The SpinButton is added as an AlarmListener to the Alarm object.

  Parameters:
    `alarm` - the alarm to trigger the value change.
  See Also:
    `getAlarm()`, `AlarmListener`

### setDelay

    public void setDelay(long d)

  Sets the delay before the alarm begins sending AlarmEvents. The delay is in milliseconds.

  Parameters:
    `d` - the milliseconds to delay firing the alarm.
  See Also:
    `getDelay()`

### setEnabled

    public void setEnabled(boolean enabled)

  Sets the SpinButton enabled for user input.

  Overrides:
    `setEnabled` in class `javax.swing.JComponent`
  Parameters:
    `enabled` - true to allow user input, false otherwise
  See Also:
    `Component.isEnabled()`

### setIncrementEnabled

    public void setIncrementEnabled(boolean incrEnabled)

  Sets the increment button enabled.

  Parameters:
    `incrEnabled` - if true, the increment button will be enabled; otherwise it will be grayed and disabled to user input.

### setMaximum

    public final void setMaximum(int max)

  Sets the integer value of the maximum bounds. This method calls setMaximumNumber() passing it a java.lang.Long created from max.

  Specified by:
    `setMaximum` in interface `java.awt.Adjustable`
  Parameters:
    `max` - the new value of the maximum bounds.
  See Also:
    `getMaximum()`

### setMinimum

    public final void setMinimum(int min)

  Sets the integer value of the minimum property. This method calls setMinimumNumber() passing it a java.lang.Long created from min.

  Specified by:
    `setMinimum` in interface `java.awt.Adjustable`
  Parameters:
    `min` - the new value of the minimum bounds.
  See Also:
    `getMinimum()`

### setOrientation

    public void setOrientation(int orient)

  Sets the value of the orientation property, which determines the orientation of the SpinButton arrow buttons. Calling `setOrientation` in conjunction with a `swapButtonFunction()` method call can cancel both calls out. If the setOrientation method is called after the buttons have been swapped the buttons will be back in their default positions for the respective orientation that they were set to. Another call to swapButtonFunction() is required to swap the buttons back to their previous state before the setOrientation() call.

  Parameters:
    `orientation` - the new value of the orientation property: either HORIZONTAL or VERTICAL.
  See Also:
    `swapButtonFunction()`, `getOrientation()`

### setStartInterval

    public void setStartInterval(long interval)

  Sets the start interval for the alarm in milliseconds. The alarm interval gets shorter the longer the alarm is fired( the longer the button is held down).

  Parameters:
    `interval` - the start interval for the alarm.
  See Also:
    `getStartInterval()`

### setUnitIncrement

    public final void setUnitIncrement(int unit)

  Sets the integer value of the unitIncrement for the SpinButton. Sets the value by how much the spin button will increment or decrement when the buttons are pressed. This method calls setUnitIncrementNumber() passing it a java.lang.Long created from unit.

  Specified by:
    `setUnitIncrement` in interface `java.awt.Adjustable`
  Parameters:
    `unit` - the amount the value is incremented/decremented when the SpinButton is triggered.
  See Also:
    `getUnitIncrement()`

### setValue

    public final void setValue(int newValue)

  Sets the integer value of the value property. This method calls setNumberValue() passing it a java.lang.Long created from newValue.

  Specified by:
    `setValue` in interface `java.awt.Adjustable`
  Parameters:
    `newValue` - the new value of the SpinButton.
  See Also:
    `getValue()`

### getUnitIncrementNumber

    public java.lang.Number getUnitIncrementNumber()

  Get the unitIncrement number based on the model.

  Specified by:
    `getUnitIncrementNumber` in interface `com.sas.models.IncrementInterface`
  Returns:
    the model unitIncrement number or null if no model is set.
  See Also:
    `setUnitIncrementNumber(java.lang.Number)`

### getBlockIncrementNumber

    public java.lang.Number getBlockIncrementNumber()

  Get the blockIncrement number based on the model.

  Specified by:
    `getBlockIncrementNumber` in interface `com.sas.models.IncrementInterface`
  Returns:
    the model blockIncrement number or null if no model is set.
  See Also:
    `setBlockIncrementNumber(java.lang.Number)`

### getMaximumNumber

    public java.lang.Number getMaximumNumber()

  Get the maximum bounds number based on the model.

  Returns:
    the model maximum bounds number or null if no model is set.
  See Also:
    `setMaximumNumber(java.lang.Number)`

### getMinimumNumber

    public java.lang.Number getMinimumNumber()

  Get the minimum bounds number based on the model.

  Returns:
    the model minimum bounds number or null if no model is set.
  See Also:
    `setMinimumNumber(java.lang.Number)`

### getNumberValue

    public java.lang.Number getNumberValue()

  Get the value number based on the model.

  Returns:
    the model value number or null if no model is set.
  See Also:
    `setNumberValue(java.lang.Number)`

### setMaximumNumber

    public void setMaximumNumber(java.lang.Number max)

  Sets the maximum bounds number.

  Parameters:
    `max` - the new maximum bounds for the SpinButton value.
  See Also:
    `getMaximumNumber()`

### setMinimumNumber

    public void setMinimumNumber(java.lang.Number min)

  Sets the minimum bounds number.

  Parameters:
    `min` - the new minimum bounds for the SpinButton value.
  See Also:
    `getMinimumNumber()`

### setBlockIncrementNumber

    public void setBlockIncrementNumber(java.lang.Number block)

  Sets the blockIncrement number.

  Specified by:
    `setBlockIncrementNumber` in interface `com.sas.models.IncrementInterface`
  Parameters:
    `block` - the new blockIncrement number.
  See Also:
    `getBlockIncrementNumber()`

### setUnitIncrementNumber

    public void setUnitIncrementNumber(java.lang.Number unit)

  Sets the unitIncrement number.

  Specified by:
    `setUnitIncrementNumber` in interface `com.sas.models.IncrementInterface`
  Parameters:
    `unit` - the new blockIncrement number.
  See Also:
    `getUnitIncrementNumber()`

### setNumberValue

    public void setNumberValue(java.lang.Number newValue)

  Sets the number value.

  Parameters:
    `newValue` - the new SpinButton value.
  See Also:
    `getNumberValue()`

### setVisibleAmount

    public void setVisibleAmount(int amount)

  NOT USED, only here to satisfy Adjustable interface.

  Specified by:
    `setVisibleAmount` in interface `java.awt.Adjustable`

### swapButtonFunction

    public int swapButtonFunction()

  Swaps the increment and decrement buttons, so if the incrementer was the Top or Left button, it is now the Bottom or Right button. Possible problem occurs when called at the same time as the setOrientation() method. If the setOrientation method is called after the buttons have been swapped the buttons will be back in their default positions for the respective orientation that they were set to. Another call to swapButtonFunction() is required to swap the buttons back to their previous state before the setOrientation call.

  Returns:
    0 if the incrementer is the Top or Left buttons; 1 if the incrementer is the Bottom or Right buttons.
  See Also:
    `setOrientation(int)`

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.