uic.widgets
Class UICSpinbox

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by uic.widgets.UICSpinbox
All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible

public class UICSpinbox
extends JComponent
implements PropertyChangeListener, Accessible

UIC Enhanced Spinbox (an equivalent for javax.swing.Spinner). This Spinbox only supports numbers, but it has a number of features that makes this component easier to use for the user.
Features:

Keys that can be used for this component:

See Also:
Serialized Form

Nested Class Summary
protected  class UICSpinbox.SimpleFormat
          Simple formatter iplementation.
protected  class UICSpinbox.SpinboxAccessibleContext
          Returns an enhanced accessible jtextfield context.
protected  class UICSpinbox.SpinboxArrowButton
          Special button shown at the right of the spinbox
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
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
UICSpinbox(SpinboxModelInterface model)
          Convenience constructor.
UICSpinbox(SpinboxModelInterface model, NumberFormat format)
          The constructor.
 
Method Summary
 void addChangeListener(ChangeListener listener)
          Add a listener for value changed.
 void buttonDownPressedSlot()
           
 void buttonUpPressedSlot()
           
 void commit()
          Commit the current textvalue to the model.
 double doubleValue()
          Convenience method for getvalue().doubleValue()
 AccessibleContext getAccessibleContext()
           
 Dimension getMaximumSize()
           
 Dimension getMinimumSize()
           
 SpinboxModelInterface getModel()
          Returns the spinbox model.
 Number getValue()
          Returns the value set after commiting the current text.
 int intValue()
          Convenience method for getvalue().intValue()
 void propertyChange(PropertyChangeEvent e)
           
 void removeChangeListener(ChangeListener listener)
          Remove a listener for value changed.
 void requestFocus()
           
 boolean requestFocus(boolean b)
           
 void setEnabled(boolean enabled)
           
 void setModel(SpinboxModelInterface model)
          Sets the spinbox model
 void setPrefix(String prefix)
           
 void setSuffix(String suffix)
           
 void setValue(Number value)
          Set the value to the model.
 TranslationInterface translate()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, 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
 

Constructor Detail

UICSpinbox

public UICSpinbox(SpinboxModelInterface model)
Convenience constructor. Same as calling new UICSpinbox(model, null);


UICSpinbox

public UICSpinbox(SpinboxModelInterface model,
                  NumberFormat format)
The constructor.

Parameters:
model - the model for setting the value limits
format - the formatter for displaying the number value
Method Detail

setModel

public void setModel(SpinboxModelInterface model)
Sets the spinbox model


setPrefix

public void setPrefix(String prefix)

setSuffix

public void setSuffix(String suffix)

getModel

public SpinboxModelInterface getModel()
Returns the spinbox model.


getValue

public Number getValue()
Returns the value set after commiting the current text.

Returns:
the current value set.

setValue

public void setValue(Number value)
Set the value to the model. If it is not exactly in the range of the models possible values, the value set will be adjusted to the closest matching one

Parameters:
value - the value to be set NOTE: setting the value clears the current undo/redo history

intValue

public int intValue()
Convenience method for getvalue().intValue()


doubleValue

public double doubleValue()
Convenience method for getvalue().doubleValue()


addChangeListener

public void addChangeListener(ChangeListener listener)
Add a listener for value changed.


removeChangeListener

public void removeChangeListener(ChangeListener listener)
Remove a listener for value changed.


propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent

requestFocus

public boolean requestFocus(boolean b)
Overrides:
requestFocus in class JComponent

commit

public void commit()
Commit the current textvalue to the model.


buttonUpPressedSlot

public void buttonUpPressedSlot()

buttonDownPressedSlot

public void buttonDownPressedSlot()

getMinimumSize

public Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent

getMaximumSize

public Dimension getMaximumSize()
Overrides:
getMaximumSize in class JComponent

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class JComponent

getAccessibleContext

public AccessibleContext getAccessibleContext()
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent

translate

public TranslationInterface translate()


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence