org.openide.awt
Class SpinButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--org.openide.awt.SpinButton
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class SpinButton
extends Canvas

A class that produces a Spin Button.

PropertyProperty TypeDescription
Orientation boolean Orientation of SpinButton (Left-right or Up-down)
Minimum int Minimum value.
Maximum int Maximum value.
Step int Step.
Value int Current value.
RepeatDelay int Delay time after press SpinButton [ms]
RepeatRate int Repeat rate while holding PressButton [ms]

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent
 
Field Summary
protected  boolean arrowsOrientation
          Current orientation of arrows of SpinButton.
protected  boolean boundsIgnored
           
static int DEFAULT_MAXIMUM
          Default maximum.
static int DEFAULT_MINIMUM
          Default minimum.
static boolean DEFAULT_ORIENTATION
          Default orientation of SpinButton.
static int DEFAULT_REPEAT_DELAY
          Default value of repeatDelay.
static int DEFAULT_REPEAT_RATE
          Default value of repeatRate.
static int DEFAULT_STEP
          Default step.
protected  int maximum
          Maximum of the range of the SpinButton.
protected  int minimum
          Minimum of the range of the SpinButton.
protected  boolean orientation
          Current orientation of SpinButton.
protected  int repeatDelay
          Adjusts the amount of time that elapses before a increment (or decrement) begins repeating when you hold down a mouse button.
protected  boolean repeating
          Flag if the SpinRepeatThread is currently running.
protected  int repeatRate
          Adjusts the speed at which a increment (or decrement) repeats when you hold down a mouse button.
protected  org.openide.awt.SpinButton.RepeatThread rt
          Spin repeat thread.
protected  boolean running
          Flag if the SpinRepeatThread is currently running.
protected  boolean runningDir
          Current direction of the run of the SpinRepeatThread.
protected  int step
          Step of the SpinButton.
protected  int value
          Value of the SpinButton.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SpinButton()
          Create new SpinButton.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addSpinButtonListener(SpinButtonListener spinButtonListener)
           
 boolean getArrowsOrientation()
          Gets the current orientation of Arrows of SpinButton.
 int getDelay()
          Gets the current value of repeatDelay variable.
 int getMaximum()
          Gets the current maximum of the range of SpinButton.
 int getMinimum()
          Gets the current minimum of the range of SpinButton.
 Dimension getMinimumSize()
           
 boolean getOrientation()
          Gets the current orientation of SpinButton.
 Dimension getPreferredSize()
           
 int getRate()
          Gets the current value of rate variable.
 int getStep()
          Gets the current step of the SpinButton.
 int getValue()
          Gets the current value of the SpinButton.
 boolean isBoundsIgnored()
           
 boolean isRepeating()
           
 void notifySpinButtonListenersAboutDownMove()
           
 void notifySpinButtonListenersAboutUpMove()
           
 void paint(Graphics g)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void removeSpinButtonListener(SpinButtonListener spinButtonListener)
           
protected  void repeatThreadNotify()
           
 void setArrowsOrientation(boolean aDir)
          Sets the new orientation of arows.
 void setBoundsIgnored(boolean ignored)
           
 void setDelay(int aDelay)
          Sets new value of repeatDelay variable.
 void setForeground(Color color)
          Setter method for foreground color.
 void setMaximum(int aMax)
          Sets a maximum of the range of the SpinButton.
 void setMinimum(int aMin)
          Sets a minimum of the range of the SpinButton.
 void setOrientation(boolean aDir)
          Sets the new orientation.
 void setRate(int aRate)
          Sets new value of repeatRate variable.
 void setRepeating(boolean aRepeating)
           
 void setStep(int aStep)
          Sets a new step of the SpinButton.
 void setValue(int aValue)
          Sets a new value of the SpinButton.
protected  void switchRun(boolean aDirect)
           
 void switchStop()
           
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ORIENTATION

public static final boolean DEFAULT_ORIENTATION
Default orientation of SpinButton. Currently false (UP-DOWN).
See Also:
DEFAULT_ORIENTATION, setOrientation(boolean), getOrientation()

orientation

protected boolean orientation
Current orientation of SpinButton. True = LEFT-RIGHT, False = UP-DOWN
See Also:
DEFAULT_ORIENTATION, setOrientation(boolean), getOrientation()

arrowsOrientation

protected boolean arrowsOrientation
Current orientation of arrows of SpinButton. True = LEFT-RIGHT, False = UP-DOWN
See Also:
DEFAULT_ORIENTATION, setOrientation(boolean), getOrientation()

DEFAULT_MINIMUM

public static final int DEFAULT_MINIMUM
Default minimum. Currently 0.
See Also:
minimum, setMinimum(int), getMinimum()

minimum

protected int minimum
Minimum of the range of the SpinButton.
See Also:
DEFAULT_MINIMUM, setMinimum(int), getMinimum()

DEFAULT_MAXIMUM

public static final int DEFAULT_MAXIMUM
Default maximum. Currently 100.
See Also:
maximum, setMaximum(int), getMaximum()

maximum

protected int maximum
Maximum of the range of the SpinButton.
See Also:
DEFAULT_MAXIMUM, setMaximum(int), getMaximum()

DEFAULT_STEP

public static final int DEFAULT_STEP
Default step. Currently 1.
See Also:
step, setStep(int), getStep()

step

protected int step
Step of the SpinButton.
See Also:
DEFAULT_STEP, setStep(int), getStep()

value

protected int value
Value of the SpinButton. Default 0.
See Also:
setValue(int), getValue()

DEFAULT_REPEAT_DELAY

public static final int DEFAULT_REPEAT_DELAY
Default value of repeatDelay. Currently 300 ms.
See Also:
setDelay(int), getDelay(), repeatDelay

repeatDelay

protected int repeatDelay
Adjusts the amount of time that elapses before a increment (or decrement) begins repeating when you hold down a mouse button. [ms]
See Also:
setDelay(int), getDelay(), DEFAULT_REPEAT_DELAY

DEFAULT_REPEAT_RATE

public static final int DEFAULT_REPEAT_RATE
Default value of repeatRate. Currently 70 ms.
See Also:
setRate(int), getRate(), repeatRate

repeatRate

protected int repeatRate
Adjusts the speed at which a increment (or decrement) repeats when you hold down a mouse button. [ms]
See Also:
setRate(int), getRate(), DEFAULT_REPEAT_RATE

rt

protected org.openide.awt.SpinButton.RepeatThread rt
Spin repeat thread. When the SpinButton is holded this thread runs and regulary sends the events to SpinButton.

running

protected boolean running
Flag if the SpinRepeatThread is currently running.

repeating

protected boolean repeating
Flag if the SpinRepeatThread is currently running.

runningDir

protected boolean runningDir
Current direction of the run of the SpinRepeatThread.

boundsIgnored

protected boolean boundsIgnored
Constructor Detail

SpinButton

public SpinButton()
Create new SpinButton.
Method Detail

setForeground

public void setForeground(Color color)
Setter method for foreground color.
Overrides:
setForeground in class Component
Parameters:
Color - color New foreground color.

setOrientation

public void setOrientation(boolean aDir)
Sets the new orientation.
Parameters:
aDir - new value of orientation.
See Also:
orientation, DEFAULT_ORIENTATION, getOrientation()

setArrowsOrientation

public void setArrowsOrientation(boolean aDir)
Sets the new orientation of arows.
Parameters:
aDir - new value of orientation of arows.
See Also:
orientation, DEFAULT_ORIENTATION, getOrientation()

getOrientation

public boolean getOrientation()
Gets the current orientation of SpinButton.
Returns:
value of orientation.
See Also:
orientation, DEFAULT_ORIENTATION, setOrientation(boolean)

getArrowsOrientation

public boolean getArrowsOrientation()
Gets the current orientation of Arrows of SpinButton.
Returns:
value of orientation of Arrows.
See Also:
orientation, DEFAULT_ORIENTATION, setOrientation(boolean)

setMinimum

public void setMinimum(int aMin)
Sets a minimum of the range of the SpinButton. If value or maximum fall out of acceptable values they are adjusted.
Parameters:
aMin - New minimum.
See Also:
getMinimum()

getMinimum

public int getMinimum()
Gets the current minimum of the range of SpinButton.
Returns:
Minimum.
See Also:
setMinimum(int)

setMaximum

public void setMaximum(int aMax)
Sets a maximum of the range of the SpinButton. If value or minimum fall out of acceptable values they are adjusted.
Parameters:
aMax - New maximum.
See Also:
getMinimum()

getMaximum

public int getMaximum()
Gets the current maximum of the range of SpinButton.
Returns:
Maximum.
See Also:
setMaximum(int)

setValue

public void setValue(int aValue)
Sets a new value of the SpinButton. If value is outside the ranges it is set to nearest acceptable value.
Parameters:
aValue - New value.
See Also:
getValue()

getValue

public int getValue()
Gets the current value of the SpinButton.
Returns:
Value.
See Also:
setValue(int)

setStep

public void setStep(int aStep)
Sets a new step of the SpinButton.
Parameters:
aStep - New step.
See Also:
getStep()

getStep

public int getStep()
Gets the current step of the SpinButton.
Returns:
Step.
See Also:
setStep(int)

setDelay

public void setDelay(int aDelay)
Sets new value of repeatDelay variable.
Parameters:
aDelay - New delay.
See Also:
repeatDelay, getDelay()

getDelay

public int getDelay()
Gets the current value of repeatDelay variable.
Returns:
Delay.
See Also:
repeatDelay, setDelay(int)

setRate

public void setRate(int aRate)
Sets new value of repeatRate variable.
Parameters:
aRate - New rate.
See Also:
repeatRate, getRate()

getRate

public int getRate()
Gets the current value of rate variable.
Returns:
Rate.
See Also:
repeatRate, setRate(int)

isBoundsIgnored

public boolean isBoundsIgnored()

setBoundsIgnored

public void setBoundsIgnored(boolean ignored)

isRepeating

public boolean isRepeating()

setRepeating

public void setRepeating(boolean aRepeating)

paint

public void paint(Graphics g)
Overrides:
paint in class Canvas

switchRun

protected void switchRun(boolean aDirect)

switchStop

public void switchStop()

getMinimumSize

public Dimension getMinimumSize()
Overrides:
getMinimumSize in class Component

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class Component

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Overrides:
addPropertyChangeListener in class Component

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Overrides:
removePropertyChangeListener in class Component

addSpinButtonListener

public void addSpinButtonListener(SpinButtonListener spinButtonListener)

removeSpinButtonListener

public void removeSpinButtonListener(SpinButtonListener spinButtonListener)

notifySpinButtonListenersAboutUpMove

public void notifySpinButtonListenersAboutUpMove()

notifySpinButtonListenersAboutDownMove

public void notifySpinButtonListenersAboutDownMove()

repeatThreadNotify

protected void repeatThreadNotify()


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.