|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.tensegrity.gui.swing.control.spinbutton.AbstractSpinTextField
The AbstractSpinTextField class offers jdk1.3. users a simplified clone of the jdk1.4 JSpinner control.
The AbstractSpinTextField is a TextField right next to a SpinButton which enables the user to enter values manually and see the current value of the SpinButton. This TextField receives ActionEvents from the SpinButton to reflect changes and also updates the SpinButton value according to users input.
This class only defines the basic behavior. Its required to add implementations according to a value type like Integer, Double, Float, etc.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
protected int |
digits
The amount of digits the internal TextField should provide space for. |
protected java.util.ArrayList |
listeners
List of listeners. |
protected com.tensegrity.gui.swing.control.spinbutton.AbstractSpinButton |
spinButton
the spin button. |
protected javax.swing.JTextField |
textField
The swing TextField. |
| 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 | |
AbstractSpinTextField(java.lang.Number min,
java.lang.Number max,
java.lang.Number step,
java.lang.Number initial)
Creates a new AbstractSpinTextField with the specified minimum-, maximum-, initial- and step value. |
|
AbstractSpinTextField(java.lang.Number min,
java.lang.Number max,
java.lang.Number step,
java.lang.Number initial,
int digits)
Creates a new SpinTextField the specified minimum-, maximum-, initial- and step value. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked by the SpinButton. |
void |
addActionListener(java.awt.event.ActionListener listener)
Method addActionListener adds an ActionListener to the internal list of listeners. |
void |
addKeyListener(java.awt.event.KeyListener l)
|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
does nothing. |
void |
changedUpdate(javax.swing.event.DocumentEvent e)
does nothing. |
protected abstract javax.swing.text.Document |
createDocument()
Creates a Document used for the TextField. |
protected abstract com.tensegrity.gui.swing.control.spinbutton.AbstractSpinButton |
createSpinButton(java.lang.Number min,
java.lang.Number max,
java.lang.Number step,
java.lang.Number initial)
Creates the required SpinButton control, which allows user to increase or decrease the current value of this SpinTextField. |
protected abstract int |
getColumnCount()
Returns the number of columns for the resulting TextField. |
protected java.text.DecimalFormat |
getFormatter()
Returns the DecimalFormatter for the TextField String. |
protected java.lang.Number |
getMaximum()
Returns the maximum from the SpinButton. |
protected java.lang.Number |
getMinimum()
Returns the minimum as it is set on the SpinButton. |
abstract java.lang.Number |
getValue()
Method getValue returns the current value of the SpinTextField. |
void |
insertUpdate(javax.swing.event.DocumentEvent e)
Sets the value at the internal SpinButton and posts an Event. |
void |
layoutContainer(java.awt.Container parent)
Layouts the components. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container parent)
Returns the preferredLayoutSize of the parent. |
protected void |
postEvent(java.lang.Number value)
Method postEvent is called every time an ActionEvent occurs. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container parent)
Returns the preferred size of the Container. |
void |
removeKeyListener(java.awt.event.KeyListener l)
|
void |
removeLayoutComponent(java.awt.Component comp)
does nothing. |
void |
removeListener(java.awt.event.ActionListener listener)
Method removeListener removes the given listener from the internal list. |
void |
removeUpdate(javax.swing.event.DocumentEvent e)
Does nothing. |
void |
requestFocus()
|
void |
setEnabled(boolean enabled)
|
void |
setMaximum(java.lang.Number max)
Changes the upper bound on the SpinButton to the given one. |
void |
setMinimum(java.lang.Number min)
Changes the lower bound for numbers to the given one. |
abstract void |
setValue(java.lang.Number number)
Sets the new value on the TextField and the SpinButton. |
void |
updateUI()
|
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
| 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, 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, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, 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, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, 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, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
| Field Detail |
protected com.tensegrity.gui.swing.control.spinbutton.AbstractSpinButton spinButton
protected javax.swing.JTextField textField
protected java.util.ArrayList listeners
protected int digits
| Constructor Detail |
public AbstractSpinTextField(java.lang.Number min,
java.lang.Number max,
java.lang.Number step,
java.lang.Number initial)
min - the minimum value as float.max - the maximum value as float.step - the value the SpinTextField should increase or decrease the
current value.initial - the initial value for the SpinTextField.
public AbstractSpinTextField(java.lang.Number min,
java.lang.Number max,
java.lang.Number step,
java.lang.Number initial,
int digits)
Document, obtained through the
createDocument() call. Then a appropriate
SpinButton is created by calling the
createSpinButton(Number, Number, Number, Number)
-method.
The digits parameter is then used to create a suitable
DecimalFormat instance to format the String output for the internal TextField.
min - the minimum value as float.max - the maximum value as float.step - the value the SpinTextField should increase or decrease the
current value.initial - the initial value for the SpinTextField.digits - number of digits to display.| Method Detail |
protected java.text.DecimalFormat getFormatter()
DecimalFormatter for the TextField String. This
Formatter is responsible to create a human readable String from the current
Value.
protected abstract javax.swing.text.Document createDocument()
Document.
protected abstract com.tensegrity.gui.swing.control.spinbutton.AbstractSpinButton createSpinButton(java.lang.Number min,
java.lang.Number max,
java.lang.Number step,
java.lang.Number initial)
min - the minimum value of this SpinTextField.max - the maximum value of this SpinTextField.step - the value to step up or down, whenever an ArrowButton is
clicked.initial - the initial value.
AbstractSpinButton.protected abstract int getColumnCount()
JTextField.JTextField(javax.swing.text.Document, java.lang.String, int)public void addActionListener(java.awt.event.ActionListener listener)
listener - an instance of class ActionListener.public void removeListener(java.awt.event.ActionListener listener)
listener - the ActionListener to remove.protected void postEvent(java.lang.Number value)
value - the new value to distribute among the listeners.public abstract java.lang.Number getValue()
public void setEnabled(boolean enabled)
JComponent.setEnabled(boolean)public abstract void setValue(java.lang.Number number)
number - the new value as Number.public void setMinimum(java.lang.Number min)
min - the new lower boundprotected java.lang.Number getMinimum()
public void setMaximum(java.lang.Number max)
max - the new upper boundprotected java.lang.Number getMaximum()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerActionListener.actionPerformed(ActionEvent)
public void addLayoutComponent(java.lang.String name,
java.awt.Component comp)
addLayoutComponent in interface java.awt.LayoutManagerLayoutManager.addLayoutComponent(String, Component)public void layoutContainer(java.awt.Container parent)
layoutContainer in interface java.awt.LayoutManagerLayoutManager.layoutContainer(Container)public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
minimumLayoutSize in interface java.awt.LayoutManagerLayoutManager.minimumLayoutSize(Container),
LayoutManager.preferredLayoutSize(Container)public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
preferredLayoutSize in interface java.awt.LayoutManagerLayoutManager.preferredLayoutSize(Container)public void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent in interface java.awt.LayoutManagerLayoutManager.removeLayoutComponent(Component)public void changedUpdate(javax.swing.event.DocumentEvent e)
changedUpdate in interface javax.swing.event.DocumentListenerDocumentListener.changedUpdate(DocumentEvent)public void insertUpdate(javax.swing.event.DocumentEvent e)
insertUpdate in interface javax.swing.event.DocumentListenerDocumentListener.insertUpdate(DocumentEvent),
postEvent(Number)public void removeUpdate(javax.swing.event.DocumentEvent e)
removeUpdate in interface javax.swing.event.DocumentListenerDocumentListener.removeUpdate(DocumentEvent)public void updateUI()
public void addKeyListener(java.awt.event.KeyListener l)
public void removeKeyListener(java.awt.event.KeyListener l)
public void requestFocus()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||