JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.swing
Class JCSpinNumberBox

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.util.swing.AbstractSpinBox
                          |
                          +--com.klg.jclass.util.swing.JCSpinNumberBox
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
YearSpin

public class JCSpinNumberBox
extends AbstractSpinBox

A spin box component whose spin arrows allow a user to increment or decrement the contained Number value by the specified spinStep amount.

See Also:
Serialized Form

Nested Class Summary
static class JCSpinNumberBox.Range
          Public static class to pass in and out the allowable Range of the value.
 
Nested classes inherited from class com.klg.jclass.util.swing.AbstractSpinBox
AbstractSpinBox.ArrowButton, AbstractSpinBox.MetalArrowButton, AbstractSpinBox.MetalBorder
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int FLOATING_POINT
           
protected  NumberFormat format
           
static int INTEGER
           
protected  Number max
           
protected  Number min
           
protected  int operation
           
protected  Number step
           
 
Fields inherited from class com.klg.jclass.util.swing.AbstractSpinBox
arrowKeySpinningAllowed, buttonTimer, continuousScroll, currentButton, DECREMENT, downArrow, editable, editor, editorIsValidateRoot, INCREMENT, l, metalBorder, minimumHeight, NONE, renderer, renderPanel, rl, upArrow, userFont, valueListeners, valueModel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
JCSpinNumberBox()
           
 
Method Summary
protected  void checkArrowButtons()
          Abstract method that check if arrows should be enabled or disabled.
protected  int compare(Number n1, Number n2)
          Compares two numbers according to the operation value.
protected  String format(Number number)
          Returns the String format for the specified number, conditional on the current operation.
 String getAbout()
          Returns vendor information.
 Number getMaximumValue()
           
 Number getMinimumValue()
           
 NumberFormat getNumberFormat()
          Returns the NumberFormat object used by the spinner to parse and format numbers.
 int getOperation()
           
 Number getSpinStep()
           
 Number getValue()
           
protected  Number parse(String string)
          Returns a parsed value for the specified String, conditional on the current operation.
protected  int preferredWidthOfView()
          Overrides the preferred width to make sure the width is big enough for the formatted max and min values.
protected  void processValueChanged(com.klg.jclass.util.value.JCValueEvent event)
          This method can be overridded by the subclass
 void setAbout(String s)
          Provided for Beans property editors - has no effect.
 void setNumberFormat(NumberFormat format)
          Sets the NumberFormat object used by the spinner to parse and format numbers.
 void setOperation(int operation)
           
 void setSpinStep(Number step)
           
 void setValue(Number value)
           
 void setValue(Object o)
          Set the value displayed by the spin box.
 void setValueRange(JCSpinNumberBox.Range range)
           
 void setValueRange(Number min, Number max)
           
protected  Object spinDown()
          Return the new value generated when spinning down a notch
protected  Object spinUp()
          Return the new value generated when spinning up a notch
 
Methods inherited from class com.klg.jclass.util.swing.AbstractSpinBox
addValueListener, compareToValue, configureArrowButtons, createDecrArrow, createIncrArrow, doBorder, doFocusedLook, doLayout, doNonFocusedLook, getDecrementArrow, getEditor, getIncrementArrow, getPreferredSize, getRenderer, getValueModel, handleKeyPressed, isArrowKeySpinningAllowed, isContinuousScroll, isEditable, isEnabled, isFocusTraversable, paint, preferredHeightOfView, processFocusLost, processValueChanging, removeValueListener, requestFocus, setArrowEnabled, setArrowKeySpinningAllowed, setBackground, setContinuousScroll, setEditable, setEditor, setEnabled, setFont, setForeground, setLayout, setLocale, setRenderer, setUI, setValueModel, swapEditorRenderer, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INTEGER

public static final int INTEGER
See Also:
Constant Field Values

FLOATING_POINT

public static final int FLOATING_POINT
See Also:
Constant Field Values

operation

protected int operation

format

protected NumberFormat format

step

protected Number step

max

protected Number max

min

protected Number min
Constructor Detail

JCSpinNumberBox

public JCSpinNumberBox()
Method Detail

setOperation

public void setOperation(int operation)

getOperation

public int getOperation()

setAbout

public void setAbout(String s)
Provided for Beans property editors - has no effect.

Parameters:
s -

getAbout

public String getAbout()
Returns vendor information.

Returns:
vendor information

setSpinStep

public void setSpinStep(Number step)

getSpinStep

public Number getSpinStep()

setValue

public void setValue(Object o)
Set the value displayed by the spin box.

Overrides:
setValue in class AbstractSpinBox
Parameters:
o - The new value

setValue

public void setValue(Number value)

getValue

public Number getValue()

setValueRange

public void setValueRange(Number min,
                          Number max)

setValueRange

public void setValueRange(JCSpinNumberBox.Range range)

getMaximumValue

public Number getMaximumValue()

getMinimumValue

public Number getMinimumValue()

setNumberFormat

public void setNumberFormat(NumberFormat format)
Sets the NumberFormat object used by the spinner to parse and format numbers.

Parameters:
format -

getNumberFormat

public NumberFormat getNumberFormat()
Returns the NumberFormat object used by the spinner to parse and format numbers.

Returns:
NumberFormat object

checkArrowButtons

protected void checkArrowButtons()
Description copied from class: AbstractSpinBox
Abstract method that check if arrows should be enabled or disabled. Use setArrowEnabled to enable/disable the arrow buttons. This will do so in a thread and state friendly manner.

Specified by:
checkArrowButtons in class AbstractSpinBox
See Also:
AbstractSpinBox.setArrowEnabled(javax.swing.JButton, boolean)

format

protected String format(Number number)
Returns the String format for the specified number, conditional on the current operation.

Parameters:
number - specified number
Returns:
String format for the specified number
See Also:
setOperation(int)

parse

protected Number parse(String string)
Returns a parsed value for the specified String, conditional on the current operation.

Parameters:
string -
Returns:
parsed value for the specified String
See Also:
setOperation(int)

preferredWidthOfView

protected int preferredWidthOfView()
Overrides the preferred width to make sure the width is big enough for the formatted max and min values.

Overrides:
preferredWidthOfView in class AbstractSpinBox
Returns:

spinUp

protected Object spinUp()
Description copied from class: AbstractSpinBox
Return the new value generated when spinning up a notch

Specified by:
spinUp in class AbstractSpinBox

spinDown

protected Object spinDown()
Description copied from class: AbstractSpinBox
Return the new value generated when spinning down a notch

Specified by:
spinDown in class AbstractSpinBox

processValueChanged

protected void processValueChanged(com.klg.jclass.util.value.JCValueEvent event)
Description copied from class: AbstractSpinBox
This method can be overridded by the subclass

Overrides:
processValueChanged in class AbstractSpinBox

compare

protected int compare(Number n1,
                      Number n2)
Compares two numbers according to the operation value. null is considered to be less than all non-null values.

Parameters:
n1 -
n2 -
Returns:

Copyright © 2004 Quest Software Inc..
All rights reserved.