com.miginfocom.calendar.spinner
Class ComboDateSpinner

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.miginfocom.calendar.spinner.AbstractDateSpinner
                  extended by com.miginfocom.calendar.spinner.ComboDateSpinner
All Implemented Interfaces:
DateSpinner, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.swing.event.ChangeListener
Direct Known Subclasses:
DateComboBean

public class ComboDateSpinner
extends AbstractDateSpinner
implements java.awt.event.ActionListener, java.awt.event.KeyListener

A regular combo that shows dates/times. Can show/change any field, but normally only show one field, for instance month. Several can be grouped with a DateSpinnerGroup to represent/change a single date/time.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
ComboDateSpinner()
           
ComboDateSpinner(int calendarField, java.text.DateFormat dateFormat)
          Constructor for preferred size and default locale and time zone.
ComboDateSpinner(int calendarField, java.text.DateFormat dateFormat, int width, int height)
          Constructor for preferred size and default locale and time zone.
ComboDateSpinner(javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat)
          Constructor for preferred size and default locale and time zone.
ComboDateSpinner(javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat, int width, int height)
          Constructor for preferred size and default locale and time zone.
ComboDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int calendarField, java.text.DateFormat dateFormat)
          Constructor for preferred size.
ComboDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int calendarField, java.text.DateFormat dateFormat, int width, int height)
          Constructor
ComboDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat)
          Constructor for preferred size.
ComboDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat, int width, int height)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 java.awt.Color getBackground()
           
 javax.swing.JComboBox getComboBox()
          Returns the combo box used to display and edit values.
 java.lang.Integer getComboHeight()
           
 java.lang.Integer getComboWidth()
           
 boolean getEditable()
           
 java.awt.Font getFont()
           
 java.awt.Color getForeground()
           
 java.lang.Integer getItemCount()
          The number of items to show in the combo box.
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getToolTipText()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void setBackground(java.awt.Color bg)
           
 void setBorder(javax.swing.border.Border border)
          Sets the combo's border
 void setComboHeight(java.lang.Integer pixels)
           
 void setComboWidth(java.lang.Integer comboWidth)
           
 void setEditable(boolean b)
          Sets if the spinner's text should be editable
 void setFont(java.awt.Font font)
           
 void setForeground(java.awt.Color fg)
           
 void setItemCount(java.lang.Integer count)
          The number of items to show in the combo box.
 void setToolTipText(java.lang.String text)
           
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class com.miginfocom.calendar.spinner.AbstractDateSpinner
getCalendarField, getCalForText, getDate, getDateFormat, getDateFormatString, getDateGroupConnector, getLocale, getSpinnerComponent, getSpinnerDateModel, getTimeZone, setCalendarField, setDate, setDateFormatString, setDateGroupConnector
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, 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, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, 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

ComboDateSpinner

public ComboDateSpinner()

ComboDateSpinner

public ComboDateSpinner(int calendarField,
                        java.text.DateFormat dateFormat)
Constructor for preferred size and default locale and time zone.

Parameters:
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.

ComboDateSpinner

public ComboDateSpinner(int calendarField,
                        java.text.DateFormat dateFormat,
                        int width,
                        int height)
Constructor for preferred size and default locale and time zone.

Parameters:
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.
width - The absolute width of the i spinner. If < 0 it's the padding added to the preferred width. 0 gives the preferred width and a positive value gives that absolute width.
height - The absolute height of the i spinner. If < 0 it's the padding added to the preferred height. 0 gives the preferred height and a positive value gives that absolute height.

ComboDateSpinner

public ComboDateSpinner(java.util.TimeZone timeZone,
                        java.util.Locale locale,
                        int calendarField,
                        java.text.DateFormat dateFormat)
Constructor for preferred size.

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.

ComboDateSpinner

public ComboDateSpinner(java.util.TimeZone timeZone,
                        java.util.Locale locale,
                        int calendarField,
                        java.text.DateFormat dateFormat,
                        int width,
                        int height)
Constructor

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.
width - The absolute width of the i spinner. If < 0 it's the padding added to the preferred width. 0 gives the preferred width and a positive value gives that absolute width.
height - The absolute height of the i spinner. If < 0 it's the padding added to the preferred height. 0 gives the preferred height and a positive value gives that absolute height.

ComboDateSpinner

public ComboDateSpinner(javax.swing.SpinnerDateModel spinnerDateModel,
                        java.text.DateFormat dateFormat)
Constructor for preferred size and default locale and time zone.

Parameters:
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.

ComboDateSpinner

public ComboDateSpinner(javax.swing.SpinnerDateModel spinnerDateModel,
                        java.text.DateFormat dateFormat,
                        int width,
                        int height)
Constructor for preferred size and default locale and time zone.

Parameters:
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.
width - The absolute width of the i spinner. If < 0 it's the padding added to the preferred width. 0 gives the preferred width and a positive value gives that absolute width.
height - The absolute height of the i spinner. If < 0 it's the padding added to the preferred height. 0 gives the preferred height and a positive value gives that absolute height.

ComboDateSpinner

public ComboDateSpinner(java.util.TimeZone timeZone,
                        java.util.Locale locale,
                        javax.swing.SpinnerDateModel spinnerDateModel,
                        java.text.DateFormat dateFormat)
Constructor for preferred size.

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.

ComboDateSpinner

public ComboDateSpinner(java.util.TimeZone timeZone,
                        java.util.Locale locale,
                        javax.swing.SpinnerDateModel spinnerDateModel,
                        java.text.DateFormat dateFormat,
                        int width,
                        int height)
Constructor

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values. Should normally be showing only one field type.
width - The absolute width of the i spinner. If < 0 it's the padding added to the preferred width. 0 gives the preferred width and a positive value gives that absolute width.
height - The absolute height of the i spinner. If < 0 it's the padding added to the preferred height. 0 gives the preferred height and a positive value gives that absolute height.
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

getItemCount

public java.lang.Integer getItemCount()
The number of items to show in the combo box. If null the number is depending on the field type and what makes sense.

Returns:
The current count or null (default).
Since:
6.1.1

setItemCount

public void setItemCount(java.lang.Integer count)
The number of items to show in the combo box. If null the number is depending on the field type and what makes sense.

Parameters:
count - The new count or null (default).
Since:
6.1.1

getFont

public java.awt.Font getFont()
Specified by:
getFont in interface java.awt.MenuContainer
Overrides:
getFont in class java.awt.Component

setFont

public void setFont(java.awt.Font font)
Overrides:
setFont in class javax.swing.JComponent

getBackground

public java.awt.Color getBackground()
Overrides:
getBackground in class java.awt.Component

setBackground

public void setBackground(java.awt.Color bg)
Overrides:
setBackground in class javax.swing.JComponent

getForeground

public java.awt.Color getForeground()
Overrides:
getForeground in class java.awt.Component

setForeground

public void setForeground(java.awt.Color fg)
Overrides:
setForeground in class javax.swing.JComponent

setToolTipText

public void setToolTipText(java.lang.String text)
Overrides:
setToolTipText in class javax.swing.JComponent

getToolTipText

public java.lang.String getToolTipText()
Overrides:
getToolTipText in class javax.swing.JComponent

setBorder

public void setBorder(javax.swing.border.Border border)
Sets the combo's border

Overrides:
setBorder in class javax.swing.JComponent
Parameters:
border - The border.

getEditable

public boolean getEditable()

setEditable

public void setEditable(boolean b)
Sets if the spinner's text should be editable

Parameters:
b - a boolean

getComboHeight

public java.lang.Integer getComboHeight()

setComboHeight

public void setComboHeight(java.lang.Integer pixels)

getComboWidth

public java.lang.Integer getComboWidth()

setComboWidth

public void setComboWidth(java.lang.Integer comboWidth)

getComboBox

public javax.swing.JComboBox getComboBox()
Returns the combo box used to display and edit values.

Returns:
The combo box used to display and edit values.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.