com.miginfocom.calendar.spinner
Class SlimDateSpinner

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.SlimDateSpinner
All Implemented Interfaces:
DateSpinner, java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.swing.event.ChangeListener
Direct Known Subclasses:
DateSpinnerBean

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

A date spinner similar to JSpinner, but with a slimmer look and some more functions, popups for instance. 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
static int ALIGN_CENTER
          Aligns the date spinner to the center if there is room to spare.
static int ALIGN_FILL
          Expands the text field so that the spinner takes up all space in the horizontal dimension.
static int ALIGN_LEFT
          Aligns the date spinner to the left if there is room to spare.
static int ALIGN_RIGHT
          Aligns the date spinner to the right if there is room to spare.
static int TYPE_NO_ARROWS
          A slim look with no arrows
static int TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
          A slim look with arrows on right side, one left and one right
static int TYPE_SLIM_ARROWS_RIGHT_UNDER_OVER
          A slim look with arrows on right side, one up and one down
static int TYPE_SLIM_ARROWS_SEPARATE_SIDES
          A slim look with arrows on each side
 
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
SlimDateSpinner()
          Default JavaBean constructor.
SlimDateSpinner(int type, int calendarField, java.text.DateFormat dateFormat)
          Constructor for default timezone and locale.
SlimDateSpinner(int type, int calendarField, java.text.DateFormat dateFormat, java.awt.Color arrowColor, java.awt.Color arrowShadowColor, int arrowSize, int fieldWidth, int fieldHeight)
          Constructor for default timezone and locale.
SlimDateSpinner(int type, int calendarField, java.text.DateFormat dateFormat, int arrowSize, int fieldWidth, int fieldHeight)
          Constructor for default timezone and locale.
SlimDateSpinner(int type, javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat)
          Constructor for default timezone and locale.
SlimDateSpinner(int type, javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat, int arrowSize, int fieldWidth, int fieldHeight)
          Constructor for default timezone and locale.
SlimDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int type, int calendarField, java.text.DateFormat dateFormat)
          Constructor
SlimDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int type, int calendarField, java.text.DateFormat dateFormat, java.awt.Color arrowColor, java.awt.Color arrowShadowColor, int arrowSize, int fieldWidth, int fieldHeight)
          Constructor
SlimDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int type, int calendarField, java.text.DateFormat dateFormat, int arrowSize, int fieldWidth, int fieldHeight)
          Constructor
SlimDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int type, javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat)
          Constructor
SlimDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int type, javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat, java.awt.Color arrowColor, java.awt.Color arrowShadowColor, int arrowSize, int fieldWidth, int fieldHeight)
          Constructor
SlimDateSpinner(java.util.TimeZone timeZone, java.util.Locale locale, int type, javax.swing.SpinnerDateModel spinnerDateModel, java.text.DateFormat dateFormat, int arrowSize, int fieldWidth, int fieldHeight)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 int expandPreferredWidthFromAlternatives()
          Sets the width of the text field to the widest possible field value.
 int getAlignment()
          Property: The alignment for the spinner in the horizontal dimension if the bounds is bigger than the spinner needs.
 java.awt.Color getArrowColor()
          Property: The Color of the arrows.
 java.awt.Color getArrowDisabledColor()
          The color for the arrow if it is disabled.
 java.awt.Color getArrowDisabledShadowColor()
          The color for the arrow shadow if it is disabled.
 java.awt.Color getArrowMouseOverColor()
          The color for the arrow if mouse-overed.
 java.awt.Color getArrowMouseOverShadowColor()
          The color for the arrow shadow if mouse-overed.
 java.awt.Color getArrowPressedColor()
          The color for the arrow if pressed.
 java.awt.Color getArrowPressedShadowColor()
          The color for the arrow shadow if pressed.
 java.awt.Color getArrowShadowColor()
          Property: The Color of the arrow shadow.
 int getArrowSize()
          Property: The size of the arrows in pixels.
 java.awt.Paint getBackgroundPaint()
          Property: The paint behind the spinner text field and arrows.
 int getButtonPlacement()
          Property: Where the buttons should be placed around the text field.
 int getButtonSpacing()
          Property: The spacing in pixels between the arrows, if they are next to each other.
 javax.swing.AbstractButton getDecreaseArrowButton()
          Returns the decrease button.
 boolean getEditable()
          If the text editor should be editable.
 javax.swing.text.JTextComponent getEditor()
          Returns the component used as editor
 java.awt.Paint getEditorBackground()
          The paint for the text editor.
 javax.swing.border.Border getEditorBorder()
          The border for the text editor.
 java.lang.Integer getEditorHeight()
          A forced height in pixels that overrides the look&feel's reported preferred height.
 java.awt.Insets getEditorMargin()
          Property: The internal margin the the text field.
 java.awt.Insets getEditorSpacing()
          Returns how many empty pixels is around the text fiels.
 java.lang.Integer getEditorWidth()
          A forced width in pixels that overrides the look&feel's reported preferred width.
 javax.swing.AbstractButton getIncreaseArrowButton()
          Returns the decrease button.
 XtdImage getMinusDisabledIcon()
          The icon for the minus button if disabled.
 XtdImage getMinusIcon()
          The icon for the minus button.
 XtdImage getMinusMouseOverIcon()
          The icon for the minus button if mouse-overed.
 XtdImage getMinusPressedIcon()
          The icon for the minus button if pressed.
 XtdImage getPlusDisabledIcon()
          The icon for the plus button if disabled.
 XtdImage getPlusIcon()
          The icon for the plus button.
 XtdImage getPlusMouseOverIcon()
          The icon for the plus button if mouse-overed.
 XtdImage getPlusPressedIcon()
          The icon for the plus button if pressed.
 java.lang.Integer getPopupItemCount()
          The number of items to show in the popup when right clicking.
 java.awt.Point getPressOffset()
          How much the plus/minus buttons should move if pressed.
 int getSpinInitialDelay()
          The initial delay in milliseconds that should pass before the spinner starts to "auto-spin" when the plus/minus button is held down.
 int getSpinInitialRepeatDelay()
          The repetition delay in milliseconds between two auto-spins to start with.
 int getSpinRampUpTime()
          How many milliseconds it should take to go from SpinInitialRepeatDelay to SpinRepeatDelay.
 int getSpinRepeatDelay()
          The repetition delay in milliseconds between two auto-spins when the whole SpinRampUpTime has passed.
 int getSpinStepCount()
          Returns the number of steps to spin the Calendar field when an arrow button has been pressed.
 java.lang.String getToolTipText()
           
 boolean isEditorOpaque()
          If the text editor's background should be painted.
 boolean isPopupEnabled()
          If the popup should be shown when right clicking the text field.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
protected  void paintComponent(java.awt.Graphics g)
           
 void setAlignment(int i)
          Property: The alignment for the spinner in the horizontal dimension if the bounds is bigger than the spinner needs.
 void setArrowColor(java.awt.Color c)
          Property: The Color of the arrows.
 void setArrowDisabledColor(java.awt.Color c)
          The color for the arrow if it is disabled.
 void setArrowDisabledShadowColor(java.awt.Color c)
          The color for the arrow shadow if it is disabled.
 void setArrowMouseOverColor(java.awt.Color c)
          The color for the arrow if mouse-overed.
 void setArrowMouseOverShadowColor(java.awt.Color c)
          The color for the arrow shadow if mouse-overed.
 void setArrowPressedColor(java.awt.Color c)
          The color for the arrow if pressed.
 void setArrowPressedShadowColor(java.awt.Color c)
          The color for the arrow shadow if pressed.
 void setArrowShadowColor(java.awt.Color c)
          Property: The Color of the arrow shadow.
 void setArrowSize(int size)
          Property: The size of the arrows in pixels.
 void setBackgroundPaint(java.awt.Paint p)
          Property: The paint behind the spinner text field and arrows.
 void setButtonPlacement(int type)
          Property: Where the buttons should be placed around the text field.
 void setButtonSpacing(int i)
          Property: The spacing in pixels between the arrows, if they are next to each other.
 void setEditable(boolean b)
          If the text editor should be editable.
 void setEditorBackground(java.awt.Paint bg)
          The paint for the text editor.
 void setEditorBorder(javax.swing.border.Border border)
          The border for the text editor.
 void setEditorHeight(java.lang.Integer pixels)
          A forced height in pixels that overrides the look&feel's reported preferred height.
 void setEditorMargin(java.awt.Insets i)
          Property: The internal margin the the text field.
 void setEditorOpaque(boolean b)
          If the text editor's background should be painted.
 void setEditorSpacing(java.awt.Insets i)
          Sets empty pixels around the text fiels.
 void setEditorWidth(java.lang.Integer pixels)
          A forced width in pixels that overrides the look&feel's reported preferred width.
 void setEnabled(boolean b)
           
 void setFont(java.awt.Font font)
          Set the font for the spinner.
 java.awt.Color setForeground()
          The foreground for the text editor.
 void setForeground(java.awt.Color fg)
          The foreground for the text editor.
 void setMinusDisabledIcon(XtdImage image)
          The icon for the minus button if disabled.
 void setMinusIcon(XtdImage image)
          The icon for the minus button.
 void setMinusMouseOverIcon(XtdImage image)
          The icon for the minus button if mouse-overed.
 void setMinusPressedIcon(XtdImage image)
          The icon for the minus button if pressed.
 void setPlusDisabledIcon(XtdImage image)
          The icon for the plus button if disabled.
 void setPlusIcon(XtdImage image)
          The icon for the plus button.
 void setPlusMouseOverIcon(XtdImage image)
          The icon for the plus button if mouse-overed.
 void setPlusPressedIcon(XtdImage image)
          The icon for the plus button if pressed.
 void setPopupEnabled(boolean b)
          If the popup should be shown when right clicking the text field.
 void setPopupItemCount(java.lang.Integer count)
          The number of items to show in the popup when right clicking.
 void setPressOffset(java.awt.Point p)
          How much the plus/minus buttons should move if pressed.
 void setSpinInitialDelay(int millis)
          The initial delay in milliseconds that should pass before the spinner starts to "auto-spin" when the plus/minus button is held down.
 void setSpinInitialRepeatDelay(int millis)
          The repetition delay in milliseconds between two auto-spins to start with.
 void setSpinRampUpTime(int millis)
          How many milliseconds it should take to go from SpinInitialRepeatDelay to SpinRepeatDelay.
 void setSpinRepeatDelay(int millis)
          The repetition delay in milliseconds between two auto-spins when the whole SpinRampUpTime has passed.
 void setSpinStepCount(int count)
          Sets the number of steps to spin the Calendar field when an arrow button has been pressed.
 void setToolTipText(java.lang.String s)
           
protected  void showPop(java.awt.event.MouseEvent e)
          Show the popup menu
protected  void spinDate()
          Spinns the date forwards or backwards the required number of steps
 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, 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, 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, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, 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
 

Field Detail

TYPE_NO_ARROWS

public static final int TYPE_NO_ARROWS
A slim look with no arrows

See Also:
Constant Field Values

TYPE_SLIM_ARROWS_SEPARATE_SIDES

public static final int TYPE_SLIM_ARROWS_SEPARATE_SIDES
A slim look with arrows on each side

See Also:
Constant Field Values

TYPE_SLIM_ARROWS_RIGHT_UNDER_OVER

public static final int TYPE_SLIM_ARROWS_RIGHT_UNDER_OVER
A slim look with arrows on right side, one up and one down

See Also:
Constant Field Values

TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE

public static final int TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
A slim look with arrows on right side, one left and one right

See Also:
Constant Field Values

ALIGN_LEFT

public static final int ALIGN_LEFT
Aligns the date spinner to the left if there is room to spare.

See Also:
Constant Field Values

ALIGN_CENTER

public static final int ALIGN_CENTER
Aligns the date spinner to the center if there is room to spare.

See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
Aligns the date spinner to the right if there is room to spare.

See Also:
Constant Field Values

ALIGN_FILL

public static final int ALIGN_FILL
Expands the text field so that the spinner takes up all space in the horizontal dimension.

See Also:
Constant Field Values
Constructor Detail

SlimDateSpinner

public SlimDateSpinner()
Default JavaBean constructor.


SlimDateSpinner

public SlimDateSpinner(int type,
                       int calendarField,
                       java.text.DateFormat dateFormat)
Constructor for default timezone and locale.

Parameters:
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values.

SlimDateSpinner

public SlimDateSpinner(int type,
                       int calendarField,
                       java.text.DateFormat dateFormat,
                       int arrowSize,
                       int fieldWidth,
                       int fieldHeight)
Constructor for default timezone and locale.

Parameters:
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values.
arrowSize - The size of the arrows.
fieldWidth - The width of the textfields shown. <= 0 the width is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static width.
fieldHeight - The height of the textfields shown. <= 0 the height is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static height.

SlimDateSpinner

public SlimDateSpinner(int type,
                       int calendarField,
                       java.text.DateFormat dateFormat,
                       java.awt.Color arrowColor,
                       java.awt.Color arrowShadowColor,
                       int arrowSize,
                       int fieldWidth,
                       int fieldHeight)
Constructor for default timezone and locale.

Parameters:
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values.
arrowColor - The color for the arrows
arrowShadowColor - The color for the shadow of the arrow. Can be null for no shadow.
arrowSize - The size of the arrows.
fieldWidth - The width of the textfields shown. <= 0 the width is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static width.
fieldHeight - The height of the textfields shown. <= 0 the height is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static height.

SlimDateSpinner

public SlimDateSpinner(java.util.TimeZone timeZone,
                       java.util.Locale locale,
                       int type,
                       int calendarField,
                       java.text.DateFormat dateFormat)
Constructor

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values.

SlimDateSpinner

public SlimDateSpinner(java.util.TimeZone timeZone,
                       java.util.Locale locale,
                       int type,
                       int calendarField,
                       java.text.DateFormat dateFormat,
                       int arrowSize,
                       int fieldWidth,
                       int fieldHeight)
Constructor

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values.
arrowSize - The size of the arrows.
fieldWidth - The width of the textfields shown. <= 0 the width is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static width.
fieldHeight - The height of the textfields shown. <= 0 the height is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static height.

SlimDateSpinner

public SlimDateSpinner(java.util.TimeZone timeZone,
                       java.util.Locale locale,
                       int type,
                       int calendarField,
                       java.text.DateFormat dateFormat,
                       java.awt.Color arrowColor,
                       java.awt.Color arrowShadowColor,
                       int arrowSize,
                       int fieldWidth,
                       int fieldHeight)
Constructor

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
calendarField - The calendar field that this combo shoudl show/edit. E.g. Calendar.MONTH.
dateFormat - The dateformat used for displaying the values.
arrowColor - The color for the arrows
arrowShadowColor - The color for the shadow of the arrow. Can be null for no shadow.
arrowSize - The size of the arrows.
fieldWidth - The width of the textfields shown. <= 0 the width is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static width.
fieldHeight - The height of the textfields shown. <= 0 the height is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static height.

SlimDateSpinner

public SlimDateSpinner(int type,
                       javax.swing.SpinnerDateModel spinnerDateModel,
                       java.text.DateFormat dateFormat)
Constructor for default timezone and locale.

Parameters:
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values.

SlimDateSpinner

public SlimDateSpinner(int type,
                       javax.swing.SpinnerDateModel spinnerDateModel,
                       java.text.DateFormat dateFormat,
                       int arrowSize,
                       int fieldWidth,
                       int fieldHeight)
Constructor for default timezone and locale.

Parameters:
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values.
arrowSize - The size of the arrows.
fieldWidth - The width of the textfields shown. <= 0 the width is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static width.
fieldHeight - The height of the textfields shown. <= 0 the height is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static height.

SlimDateSpinner

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

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values.

SlimDateSpinner

public SlimDateSpinner(java.util.TimeZone timeZone,
                       java.util.Locale locale,
                       int type,
                       javax.swing.SpinnerDateModel spinnerDateModel,
                       java.text.DateFormat dateFormat,
                       int arrowSize,
                       int fieldWidth,
                       int fieldHeight)
Constructor

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values.
arrowSize - The size of the arrows.
fieldWidth - The width of the textfields shown. <= 0 the width is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static width.
fieldHeight - The height of the textfields shown. <= 0 the height is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static height.

SlimDateSpinner

public SlimDateSpinner(java.util.TimeZone timeZone,
                       java.util.Locale locale,
                       int type,
                       javax.swing.SpinnerDateModel spinnerDateModel,
                       java.text.DateFormat dateFormat,
                       java.awt.Color arrowColor,
                       java.awt.Color arrowShadowColor,
                       int arrowSize,
                       int fieldWidth,
                       int fieldHeight)
Constructor

Parameters:
timeZone - The time zone, not null.
locale - The locale. Not null.
type - The type of spinner decoration to use. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE
spinnerDateModel - The model used for choosing dates to show.
dateFormat - The dateformat used for displaying the values.
arrowColor - The color for the arrows
arrowShadowColor - The color for the shadow of the arrow. Can be null for no shadow.
arrowSize - The size of the arrows.
fieldWidth - The width of the textfields shown. <= 0 the width is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static width.
fieldHeight - The height of the textfields shown. <= 0 the height is the preferred (so the text fits) but with padding. (-2 means two pixels padding). If > 0 it's set as the static height.
Method Detail

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

getPopupItemCount

public java.lang.Integer getPopupItemCount()
The number of items to show in the popup when right clicking. 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

setPopupItemCount

public void setPopupItemCount(java.lang.Integer count)
The number of items to show in the popup when right clicking. 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

isPopupEnabled

public boolean isPopupEnabled()
If the popup should be shown when right clicking the text field.

Returns:
If the popup should be shown when right clicking the text field.
Since:
6.1.1

setPopupEnabled

public void setPopupEnabled(boolean b)
If the popup should be shown when right clicking the text field.

Parameters:
b - If the popup should be shown when right clicking the text field.
Since:
6.1.1

getBackgroundPaint

public java.awt.Paint getBackgroundPaint()
Property: The paint behind the spinner text field and arrows.

Returns:
The current paint. Default is null.

setBackgroundPaint

public void setBackgroundPaint(java.awt.Paint p)
Property: The paint behind the spinner text field and arrows.

Parameters:
p - The new paint. Default is null.

getAlignment

public int getAlignment()
Property: The alignment for the spinner in the horizontal dimension if the bounds is bigger than the spinner needs.

Returns:
The current alignment. Default is ALIGN_CENTER.

setAlignment

public void setAlignment(int i)
Property: The alignment for the spinner in the horizontal dimension if the bounds is bigger than the spinner needs.

Parameters:
i - The current alignment. Default is ALIGN_CENTER. Valid are ALIGN_XXX constants.

getSpinStepCount

public int getSpinStepCount()
Returns the number of steps to spin the Calendar field when an arrow button has been pressed. Default is 1.

Returns:
The number of steps to spin the Calendar field when an arrow button has been pressed. Default is 1

setSpinStepCount

public void setSpinStepCount(int count)
Sets the number of steps to spin the Calendar field when an arrow button has been pressed. Default is 1 Subclasses may or may not use to this value.

Parameters:
count - The number of steps to spin the Calendar field when an arrow button has been pressed. Default is 1

getButtonPlacement

public int getButtonPlacement()
Property: Where the buttons should be placed around the text field. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE

Returns:
The current placement.

setButtonPlacement

public void setButtonPlacement(int type)
Property: Where the buttons should be placed around the text field. E.g. TYPE_SLIM_ARROWS_RIGHT_SIDE_BY_SIDE

Parameters:
type - The new placement.

getArrowSize

public int getArrowSize()
Property: The size of the arrows in pixels.

Returns:
The size.

setArrowSize

public void setArrowSize(int size)
Property: The size of the arrows in pixels.

Parameters:
size - The size.

getArrowColor

public java.awt.Color getArrowColor()
Property: The Color of the arrows.

Returns:
The Color.

getButtonSpacing

public int getButtonSpacing()
Property: The spacing in pixels between the arrows, if they are next to each other.

Returns:
The current spacing.

setButtonSpacing

public void setButtonSpacing(int i)
Property: The spacing in pixels between the arrows, if they are next to each other.

Parameters:
i - The current spacing in pixels.

setArrowColor

public void setArrowColor(java.awt.Color c)
Property: The Color of the arrows.

Parameters:
c - The Color. Not null.

getArrowShadowColor

public java.awt.Color getArrowShadowColor()
Property: The Color of the arrow shadow.

Returns:
The Color.

setArrowShadowColor

public void setArrowShadowColor(java.awt.Color c)
Property: The Color of the arrow shadow.

Parameters:
c - The Color. null for no shadow.

setEditorSpacing

public void setEditorSpacing(java.awt.Insets i)
Sets empty pixels around the text fiels. Normal is 1 pixel towards the arrows.

Parameters:
i - The new spacing around the text filed. Not null

getEditorSpacing

public java.awt.Insets getEditorSpacing()
Returns how many empty pixels is around the text fiels. Normal is two pixels towards the arrows.

Returns:
The spacing around the text filed. Not null and is cloned.

getEditorMargin

public java.awt.Insets getEditorMargin()
Property: The internal margin the the text field.

Returns:
The old margin. null if set not set (default).

setEditorMargin

public void setEditorMargin(java.awt.Insets i)
Property: The internal margin the the text field.

Parameters:
i - The new margin. If null it is reset to the platform/LAF default.

getDecreaseArrowButton

public javax.swing.AbstractButton getDecreaseArrowButton()
Returns the decrease button.

Returns:
The decrease button. May be null.

getIncreaseArrowButton

public javax.swing.AbstractButton getIncreaseArrowButton()
Returns the decrease button.

Returns:
The decrease button. May be null.

stateChanged

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

expandPreferredWidthFromAlternatives

public int expandPreferredWidthFromAlternatives()
Sets the width of the text field to the widest possible field value.


getEditor

public javax.swing.text.JTextComponent getEditor()
Returns the component used as editor

Returns:
The component used as editor. Not null.

setFont

public void setFont(java.awt.Font font)
Set the font for the spinner.

Overrides:
setFont in class javax.swing.JComponent
Parameters:
font - The new font. Not null.

isEditorOpaque

public boolean isEditorOpaque()
If the text editor's background should be painted.

Returns:
The current value.

setEditorOpaque

public void setEditorOpaque(boolean b)
If the text editor's background should be painted.

Parameters:
b - The new value.

setEditorBackground

public void setEditorBackground(java.awt.Paint bg)
The paint for the text editor.

Parameters:
bg - The new background. May be null in which case the normal (Color) background will be used.
See Also:
ShapeGradientPaint, XtdTexturePaint

getEditorBackground

public java.awt.Paint getEditorBackground()
The paint for the text editor.

Returns:
bg The current background. May be null.
See Also:
ShapeGradientPaint, XtdTexturePaint

setForeground

public void setForeground(java.awt.Color fg)
The foreground for the text editor.

Overrides:
setForeground in class javax.swing.JComponent
Parameters:
fg - The new foreground. Not null.

setForeground

public java.awt.Color setForeground()
The foreground for the text editor.

Returns:
The current foreground. Not null.

setEditorBorder

public void setEditorBorder(javax.swing.border.Border border)
The border for the text editor.

Parameters:
border - The new border.

getEditorBorder

public javax.swing.border.Border getEditorBorder()
The border for the text editor.

Returns:
The current border.

setEditable

public void setEditable(boolean b)
If the text editor should be editable.

Parameters:
b - true for editable, which is default.

getEditable

public boolean getEditable()
If the text editor should be editable.

Returns:
true for editable, which is default.

getPressOffset

public java.awt.Point getPressOffset()
How much the plus/minus buttons should move if pressed.

Returns:
The current value. Never null.

setPressOffset

public void setPressOffset(java.awt.Point p)
How much the plus/minus buttons should move if pressed.

Parameters:
p - The new value. null is same as 0, 0.

getArrowDisabledColor

public java.awt.Color getArrowDisabledColor()
The color for the arrow if it is disabled.

Returns:
The current color. Can be null which means that the same color as "normal" state.

setArrowDisabledColor

public void setArrowDisabledColor(java.awt.Color c)
The color for the arrow if it is disabled.

Parameters:
c - The new color. Can be null which means that the same color as "normal" state.

getArrowDisabledShadowColor

public java.awt.Color getArrowDisabledShadowColor()
The color for the arrow shadow if it is disabled.

Returns:
The current color. Can be null which means that the same color as "normal" state.

setArrowDisabledShadowColor

public void setArrowDisabledShadowColor(java.awt.Color c)
The color for the arrow shadow if it is disabled.

Parameters:
c - The new color. Can be null which means that the same color as "normal" state.

getArrowMouseOverColor

public java.awt.Color getArrowMouseOverColor()
The color for the arrow if mouse-overed.

Returns:
The current color. Can be null which means that the same color as "normal" state.

setArrowMouseOverColor

public void setArrowMouseOverColor(java.awt.Color c)
The color for the arrow if mouse-overed.

Parameters:
c - The new color. Can be null which means that the same color as "normal" state.

getArrowMouseOverShadowColor

public java.awt.Color getArrowMouseOverShadowColor()
The color for the arrow shadow if mouse-overed.

Returns:
The current color. Can be null which means that the same color as "normal" state.

setArrowMouseOverShadowColor

public void setArrowMouseOverShadowColor(java.awt.Color c)
The color for the arrow shadow if mouse-overed.

Parameters:
c - The new color. Can be null which means that the same color as "normal" state.

getArrowPressedColor

public java.awt.Color getArrowPressedColor()
The color for the arrow if pressed.

Returns:
The current color. Can be null which means that the same color as "normal" state.

setArrowPressedColor

public void setArrowPressedColor(java.awt.Color c)
The color for the arrow if pressed.

Parameters:
c - The new color. Can be null which means that the same color as "normal" state.

getArrowPressedShadowColor

public java.awt.Color getArrowPressedShadowColor()
The color for the arrow shadow if pressed.

Returns:
The current color. Can be null which means that the same color as "normal" state.

setArrowPressedShadowColor

public void setArrowPressedShadowColor(java.awt.Color c)
The color for the arrow shadow if pressed.

Parameters:
c - The new color. Can be null which means that the same color as "normal" state.

getMinusDisabledIcon

public XtdImage getMinusDisabledIcon()
The icon for the minus button if disabled.

Returns:
The current icon. Can be null which means that the same as "normal" state.

setMinusDisabledIcon

public void setMinusDisabledIcon(XtdImage image)
The icon for the minus button if disabled.

Parameters:
image - The new icon. Can be null which means that the same as "normal" state.

getMinusMouseOverIcon

public XtdImage getMinusMouseOverIcon()
The icon for the minus button if mouse-overed.

Returns:
The current icon. Can be null which means that the same as "normal" state.

setMinusMouseOverIcon

public void setMinusMouseOverIcon(XtdImage image)
The icon for the minus button if mouse-overed.

Parameters:
image - The new icon. Can be null which means that the same as "normal" state.

getMinusIcon

public XtdImage getMinusIcon()
The icon for the minus button.

Returns:
The current icon. Can be null.

setMinusIcon

public void setMinusIcon(XtdImage image)
The icon for the minus button.

Parameters:
image - The new icon. Can be null.

getMinusPressedIcon

public XtdImage getMinusPressedIcon()
The icon for the minus button if pressed.

Returns:
The current icon. Can be null which means that the same as "normal" state.

setMinusPressedIcon

public void setMinusPressedIcon(XtdImage image)
The icon for the minus button if pressed.

Parameters:
image - The new icon. Can be null which means that the same as "normal" state.

getPlusDisabledIcon

public XtdImage getPlusDisabledIcon()
The icon for the plus button if disabled.

Returns:
The current icon. Can be null which means that the same as "normal" state.

setPlusDisabledIcon

public void setPlusDisabledIcon(XtdImage image)
The icon for the plus button if disabled.

Parameters:
image - The new icon. Can be null which means that the same as "normal" state.

getPlusMouseOverIcon

public XtdImage getPlusMouseOverIcon()
The icon for the plus button if mouse-overed.

Returns:
The current icon. Can be null which means that the same as "normal" state.

setPlusMouseOverIcon

public void setPlusMouseOverIcon(XtdImage image)
The icon for the plus button if mouse-overed.

Parameters:
image - The new icon. Can be null which means that the same as "normal" state.

getPlusIcon

public XtdImage getPlusIcon()
The icon for the plus button.

Returns:
The current icon. Can be null.

setPlusIcon

public void setPlusIcon(XtdImage image)
The icon for the plus button.

Parameters:
image - The new icon. Can be null.

getPlusPressedIcon

public XtdImage getPlusPressedIcon()
The icon for the plus button if pressed.

Returns:
The current icon. Can be null which means that the same as "normal" state.

setPlusPressedIcon

public void setPlusPressedIcon(XtdImage image)
The icon for the plus button if pressed.

Parameters:
image - The new icon. Can be null which means that the same as "normal" state.

getEditorHeight

public java.lang.Integer getEditorHeight()
A forced height in pixels that overrides the look&feel's reported preferred height.

Returns:
The current height or null if no forced height is used.

setEditorHeight

public void setEditorHeight(java.lang.Integer pixels)
A forced height in pixels that overrides the look&feel's reported preferred height.

Parameters:
pixels - The new height or null if no forced height is to be used.

getEditorWidth

public java.lang.Integer getEditorWidth()
A forced width in pixels that overrides the look&feel's reported preferred width.

Returns:
The current width or null if no forced width is used.

setEditorWidth

public void setEditorWidth(java.lang.Integer pixels)
A forced width in pixels that overrides the look&feel's reported preferred width.

Parameters:
pixels - The new width or null if no forced width is to be used.

getSpinInitialDelay

public int getSpinInitialDelay()
The initial delay in milliseconds that should pass before the spinner starts to "auto-spin" when the plus/minus button is held down.

Returns:
The current delay. Default is 300.

setSpinInitialDelay

public void setSpinInitialDelay(int millis)
The initial delay in milliseconds that should pass before the spinner starts to "auto-spin" when the plus/minus button is held down.

Parameters:
millis - The new delay. Default is 300.

getSpinInitialRepeatDelay

public int getSpinInitialRepeatDelay()
The repetition delay in milliseconds between two auto-spins to start with. This delay will gradually be closing to SpinRepeatDelay.

Returns:
The current value. Default is 250.

setSpinInitialRepeatDelay

public void setSpinInitialRepeatDelay(int millis)
The repetition delay in milliseconds between two auto-spins to start with. This delay will gradually be closing to SpinRepeatDelay.

Parameters:
millis - The new value. Default is 250.

getSpinRampUpTime

public int getSpinRampUpTime()
How many milliseconds it should take to go from SpinInitialRepeatDelay to SpinRepeatDelay.

Returns:
The current value. Default is 2000.

setSpinRampUpTime

public void setSpinRampUpTime(int millis)
How many milliseconds it should take to go from SpinInitialRepeatDelay to SpinRepeatDelay.

Parameters:
millis - The new value. Default is 2000.

getSpinRepeatDelay

public int getSpinRepeatDelay()
The repetition delay in milliseconds between two auto-spins when the whole SpinRampUpTime has passed. This delay will gradually be closing to SpinRepeatDelay.

Returns:
The current value. Default is 100.

setSpinRepeatDelay

public void setSpinRepeatDelay(int millis)
The repetition delay in milliseconds between two auto-spins when the whole SpinRampUpTime has passed. This delay will gradually be closing to SpinRepeatDelay.


actionPerformed

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

spinDate

protected void spinDate()
Spinns the date forwards or backwards the required number of steps


showPop

protected void showPop(java.awt.event.MouseEvent e)
Show the popup menu

Parameters:
e - The mouse event that starts the popup

setEnabled

public void setEnabled(boolean b)
Overrides:
setEnabled in class javax.swing.JComponent

getToolTipText

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

setToolTipText

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

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

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.