JIDE 3.5.15

com.jidesoft.combobox
Class AbstractComboBox.SpinnerEditorComponent

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.combobox.AbstractComboBox.EditorComponent
                      extended by com.jidesoft.combobox.AbstractComboBox.SpinnerEditorComponent
All Implemented Interfaces:
AlignmentSupport, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ComboBoxEditor, DocumentListener
Direct Known Subclasses:
DateSpinnerComboBox.DateSpinnerEditorComponent, NumberSpinnerComboBox.NumberSpinnerEditorComponent
Enclosing class:
AbstractComboBox

public class AbstractComboBox.SpinnerEditorComponent
extends AbstractComboBox.EditorComponent
implements DocumentListener

Default EditorComponent which has a text field. It's actually a JPanel with BorderLayout. A JTextField is added to the CENTER. Usually this is good enough for most editing purpose. However if you want, you can add more components to EAST or WEST of the BorderLayout. For example, ColorEditorComponent adds a component to the WEST to actually show the color.

getEditorComponent() will return the JTextField.

Subclass can override AbstractComboBox.EditorComponent.registerKeys(javax.swing.JComponent) to register additional keystrokes. The base class used it to register ALT-DOWN key to show the popup.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JSpinner _spinner
           
 
Fields inherited from class com.jidesoft.combobox.AbstractComboBox.EditorComponent
_class, _value
 
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
AbstractComboBox.SpinnerEditorComponent(Class<?> clazz)
          Creates a DefaultTextFieldEditorComponent.
 
Method Summary
 void addActionListener(ActionListener l)
           
 void changedUpdate(DocumentEvent e)
           
 Component getEditorComponent()
           
 int getHorizontalAlignment()
          Returns the horizontal alignment of the content.
 String getText()
          Gets the text.
protected  JFormattedTextField getTextField()
           
 void insertUpdate(DocumentEvent e)
           
 boolean isEditable()
          Gets the editable attribute.
 boolean isOpaque()
          Overrides it so that no one can set opaque to false on this component.
 void removeActionListener(ActionListener l)
           
 void removeUpdate(DocumentEvent e)
           
 void requestFocus()
           
 boolean requestFocusInWindow()
           
 void selectAll()
           
 void setEditable(boolean editable)
          Sets the editable attribute.
 void setFont(Font font)
           
 void setForeground(Color fg)
           
 void setHorizontalAlignment(int alignment)
          Sets the horizontal alignment of the content.
 void setText(String text)
          Sets the text.
 void updateUI()
           
 
Methods inherited from class com.jidesoft.combobox.AbstractComboBox.EditorComponent
convertElementToString, convertStringToElement, getItem, getPreferredSize, getVerticalAlignment, registerKeys, setItem, setVerticalAlignment, textChanged
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, 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, 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
 

Field Detail

_spinner

protected JSpinner _spinner
Constructor Detail

AbstractComboBox.SpinnerEditorComponent

public AbstractComboBox.SpinnerEditorComponent(Class<?> clazz)
Creates a DefaultTextFieldEditorComponent.

Parameters:
clazz - class type which this editor can handle.
Method Detail

setFont

public void setFont(Font font)
Overrides:
setFont in class JComponent

insertUpdate

public void insertUpdate(DocumentEvent e)
Specified by:
insertUpdate in interface DocumentListener

removeUpdate

public void removeUpdate(DocumentEvent e)
Specified by:
removeUpdate in interface DocumentListener

changedUpdate

public void changedUpdate(DocumentEvent e)
Specified by:
changedUpdate in interface DocumentListener

isOpaque

public boolean isOpaque()
Overrides it so that no one can set opaque to false on this component.

Overrides:
isOpaque in class JComponent
Returns:
always returns true.

updateUI

public void updateUI()
Overrides:
updateUI in class JPanel

getEditorComponent

public Component getEditorComponent()
Specified by:
getEditorComponent in interface ComboBoxEditor

selectAll

public void selectAll()
Specified by:
selectAll in interface ComboBoxEditor

addActionListener

public void addActionListener(ActionListener l)
Specified by:
addActionListener in interface ComboBoxEditor

removeActionListener

public void removeActionListener(ActionListener l)
Specified by:
removeActionListener in interface ComboBoxEditor

getText

public String getText()
Description copied from class: AbstractComboBox.EditorComponent
Gets the text. Since subclass can use different components to edit text, this method will provide a common interface to retrieve text from those different components.

Specified by:
getText in class AbstractComboBox.EditorComponent
Returns:
the text.

setText

public void setText(String text)
Description copied from class: AbstractComboBox.EditorComponent
Sets the text. Since subclass can use different components to edit text, this method will provide a common interface to set text to those different components.

Specified by:
setText in class AbstractComboBox.EditorComponent
Parameters:
text - the text

setEditable

public void setEditable(boolean editable)
Description copied from class: AbstractComboBox.EditorComponent
Sets the editable attribute. Since subclass can use different components to edit text, this method will provide a common interface to change editable attribute to those different components.

Specified by:
setEditable in class AbstractComboBox.EditorComponent
Parameters:
editable - true or false.

isEditable

public boolean isEditable()
Description copied from class: AbstractComboBox.EditorComponent
Gets the editable attribute. Since subclass can use different components to edit text, this method will provide a common interface to check editable attribute for those different components.

Specified by:
isEditable in class AbstractComboBox.EditorComponent
Returns:
true if the editor component is editable

setForeground

public void setForeground(Color fg)
Overrides:
setForeground in class JComponent

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent

requestFocusInWindow

public boolean requestFocusInWindow()
Overrides:
requestFocusInWindow in class JComponent

getHorizontalAlignment

public int getHorizontalAlignment()
Description copied from interface: AlignmentSupport
Returns the horizontal alignment of the content. AbstractButton's default is SwingConstants.CENTER, but subclasses such as JCheckBox may use a different default.

Specified by:
getHorizontalAlignment in interface AlignmentSupport
Overrides:
getHorizontalAlignment in class AbstractComboBox.EditorComponent
Returns:
the horizontalAlignment property, one of the following values:
  • SwingConstants.RIGHT
  • SwingConstants.LEFT
  • SwingConstants.CENTER
  • SwingConstants.LEADING
  • SwingConstants.TRAILING

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
Description copied from interface: AlignmentSupport
Sets the horizontal alignment of the content. AbstractButton's default is SwingConstants.CENTER, but subclasses such as JCheckBox may use a different default.

Specified by:
setHorizontalAlignment in interface AlignmentSupport
Overrides:
setHorizontalAlignment in class AbstractComboBox.EditorComponent
Parameters:
alignment - the alignment value, one of the following values:
  • SwingConstants.RIGHT
  • SwingConstants.LEFT
  • SwingConstants.CENTER
  • SwingConstants.LEADING
  • SwingConstants.TRAILING

getTextField

protected JFormattedTextField getTextField()

JIDE 3.5.15