swingwtx.swing
Class JSpinner

java.lang.Object
  extended byswingwt.awt.Component
      extended byswingwt.awt.Container
          extended byswingwtx.swing.JComponent
              extended byswingwtx.swing.JPanel
                  extended byswingwtx.swing.JSpinner
All Implemented Interfaces:
ChangeListener, java.util.EventListener, ImageObserver, MenuContainer

public class JSpinner
extends JPanel
implements ChangeListener

Implementation of Swing's JSpinner class. We actually use a text box and a vertical scrollbar to get the same effect with native widgets.


Nested Class Summary
 
Nested classes inherited from class swingwtx.swing.JComponent
JComponent.InternalFrameSelectionListener
 
Field Summary
protected static int CANCELED
           
protected  java.util.Vector changeListeners
          Item events
protected static int INVISIBLE
           
protected  int lastValue
           
protected  SpinnerModel model
          Model
protected  JScrollBar spin
           
protected  JTextField text
          Composite Components
protected static int VISIBLE
           
 
Fields inherited from class swingwtx.swing.JPanel
opaque, ppeer
 
Fields inherited from class swingwtx.swing.JComponent
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap
 
Fields inherited from class swingwt.awt.Container
composite, comps, containerListeners, layout, queuedValidateRequest
 
Fields inherited from class swingwt.awt.Component
actionCommand, actionListeners, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListeners, componentName, consumeAvailableHeight, consumeAvailableWidth, focusable, focusListeners, graphicsConfig, inputMethodListeners, isUserSetFont, keyListeners, layoutModifier, LEFT_ALIGNMENT, LOCK, mouseListeners, mouseMotionListeners, mouseWheelListeners, parent, pBackground, pCursor, pDoubleBuffered, peer, pEnabled, pFont, pForeground, pLayoutData, pLocation, pMaxSize, pMinSize, pPrefSize, pSize, pToolTipText, pVisible, RIGHT_ALIGNMENT, swingWTDefaultActionEventAdapter, swingWTEventAdapter, TOP_ALIGNMENT
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JSpinner()
           
JSpinner(SpinnerModel model)
           
 
Method Summary
 void addChangeListener(ChangeListener l)
           
 void addFocusListener(FocusListener l)
          Add a KeyListener to this component
 void addKeyListener(KeyListener l)
          Add a KeyListener to this component
protected  Dimension calculatePreferredSize()
          Overriden to calculate non-realised preferred size.
 JTextField getJTextField()
           
 SpinnerModel getModel()
           
 java.lang.String getToolTipText()
          Returns the tooltip text used on the component
 java.lang.Object getValue()
           
 void grabFocus()
          Forces keyboard focus to the component
 boolean isEnabled()
          Returns true if the component is enabled
protected  void nextItem()
           
protected  void previousItem()
           
 void processChangeEvent(ChangeEvent e)
           
 void removeFocusListener(FocusListener l)
          Remove an KeyListener from the component
 void removeItemListener(ChangeListener l)
           
 void removeKeyListener(KeyListener l)
          Remove an KeyListener from the component
 void requestFocus()
          Requests the component receives the focus
 void setBounds(int x, int y, int width, int height)
          Component displays oddly since we used a vertical scrollbar.
 void setEnabled(boolean b)
          Change the enabled state of the component
 void setModel(SpinnerModel model)
           
 void setSwingWTParent(Container parent)
          Callback for when this is added to a Container to create the peer and load cached values.
 void setToolTipText(java.lang.String tip)
          Sets the tooltip text used on the component
 void setValue(java.lang.Object o)
           
 void stateChanged(ChangeEvent e)
           
 
Methods inherited from class swingwtx.swing.JPanel
getHeight, getSize, getWidth, setBorder
 
Methods inherited from class swingwtx.swing.JComponent
add, add, add, add, add, addPropertyChangeListener, addPropertyChangeListener, checkInternalFrameChild, dispose, getAccessibleContext, getActionMap, getAutoscrolls, getBorder, getClientProperty, getInputMap, getInsets, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isValidateRoot, paint, paintBackground, paintChildren, paintComponent, paintImmediately, paintImmediately, putClientProperty, remove, remove, removePropertyChangeListener, removePropertyChangeListener, repaint, revalidate, scrollRectToVisible, setActionMap, setAutoscrolls, setDoubleBuffered, setInputMap, setMargin, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled
 
Methods inherited from class swingwt.awt.Container
addComponentToLayout, addContainerListener, debug_showContainmentTree, doAdd, doLayout, getComponent, getComponentCount, getComponentOrientation, getComponents, getComposite, getLayout, getMaximumSize, getMinimumSize, getParent, getPreferredSize, invalidate, minimumSize, preferredSize, processContainerEvent, processEvent, queuedValidate, removeAll, removeComponentFromCache, removeContainerListener, setLayout, setLayoutImpl, validate
 
Methods inherited from class swingwt.awt.Component
add, addActionListener, addComponentListener, addInputMethodListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, componentOnlyDispose, computePreferredSize, contains, contains, createImage, createListenerArrayFromVector, createVolatileImage, dispatchEvent, getActionCommand, getAlignmentX, getAlignmentY, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getListeners, getLocation, getLocationOnScreen, getName, getPeer, getPeerSize, getSize, getSWTPeer, getToolkit, getTreeLock, getX, getY, hasFocus, hasSetFont, hide, imageUpdate, inside, isFocusable, isMinimumSizeSet, isShowing, isVisible, processActionEvent, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processTraverseEvent, registerActionEvents, registerComponentEvents, registerEvents, registerExtendedModifyEvents, registerFocusEvents, registerKeyEvents, registerModifyEvents, registerMouseEvents, registerPaintEvents, registerTraversalEvents, remove, removeActionListener, removeComponentListener, removeInputMethodListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, repaint, repaint, repaint, setActionCommand, setAlignmentX, setAlignmentY, setBackground, setBounds, setCachedProperties, setComponentOrientation, setComponentRemoved, setCursor, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setHeight, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setVisible, setWidth, show, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changeListeners

protected java.util.Vector changeListeners
Item events


model

protected SpinnerModel model
Model


text

protected JTextField text
Composite Components


spin

protected JScrollBar spin

lastValue

protected int lastValue

CANCELED

protected static final int CANCELED
See Also:
Constant Field Values

INVISIBLE

protected static final int INVISIBLE
See Also:
Constant Field Values

VISIBLE

protected static final int VISIBLE
See Also:
Constant Field Values
Constructor Detail

JSpinner

public JSpinner()

JSpinner

public JSpinner(SpinnerModel model)
Method Detail

setModel

public void setModel(SpinnerModel model)

getModel

public SpinnerModel getModel()

addFocusListener

public void addFocusListener(FocusListener l)
Description copied from class: Component
Add a KeyListener to this component

Overrides:
addFocusListener in class Component

removeFocusListener

public void removeFocusListener(FocusListener l)
Description copied from class: Component
Remove an KeyListener from the component

Overrides:
removeFocusListener in class Component

addKeyListener

public void addKeyListener(KeyListener l)
Description copied from class: Component
Add a KeyListener to this component

Overrides:
addKeyListener in class Component

removeKeyListener

public void removeKeyListener(KeyListener l)
Description copied from class: Component
Remove an KeyListener from the component

Overrides:
removeKeyListener in class Component

addChangeListener

public void addChangeListener(ChangeListener l)

removeItemListener

public void removeItemListener(ChangeListener l)

processChangeEvent

public void processChangeEvent(ChangeEvent e)

setValue

public void setValue(java.lang.Object o)

getValue

public java.lang.Object getValue()

setEnabled

public void setEnabled(boolean b)
Description copied from class: Component
Change the enabled state of the component

Overrides:
setEnabled in class Component

isEnabled

public boolean isEnabled()
Description copied from class: Component
Returns true if the component is enabled

Overrides:
isEnabled in class Component

getToolTipText

public java.lang.String getToolTipText()
Description copied from class: Component
Returns the tooltip text used on the component

Overrides:
getToolTipText in class Component

setToolTipText

public void setToolTipText(java.lang.String tip)
Description copied from class: Component
Sets the tooltip text used on the component

Overrides:
setToolTipText in class Component

previousItem

protected void previousItem()

nextItem

protected void nextItem()

requestFocus

public void requestFocus()
Description copied from class: Component
Requests the component receives the focus

Overrides:
requestFocus in class Component

grabFocus

public void grabFocus()
Description copied from class: Component
Forces keyboard focus to the component

Overrides:
grabFocus in class Component

getJTextField

public JTextField getJTextField()

stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Component displays oddly since we used a vertical scrollbar. This should lock it to no more than 30 pixels in height when LayoutManagers try to update it

Overrides:
setBounds in class Component

calculatePreferredSize

protected Dimension calculatePreferredSize()
Overriden to calculate non-realised preferred size.

Overrides:
calculatePreferredSize in class JPanel

setSwingWTParent

public void setSwingWTParent(Container parent)
                      throws java.lang.Exception
Description copied from class: JPanel
Callback for when this is added to a Container to create the peer and load cached values.

Overrides:
setSwingWTParent in class JPanel
Throws:
java.lang.Exception