Java Date Picker v3.2

com.standbysoft.component.date.swing
Class JDatePicker

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.standbysoft.component.date.swing.JDateComponent
                  extended bycom.standbysoft.component.date.swing.JDateEditComponent
                      extended bycom.standbysoft.component.date.swing.JDatePicker
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JDatePicker
extends JDateEditComponent

A date picker is an advanced date edit component that not only allows to edit dates but also allows to select them by means of a drop down calendar. The editable property is configurable and it is not active by default.

When set as editable, the date picker can be configured just like any other JDateEditComponent. The extra methods this class adds are used to configure the drop-down calendar.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.standbysoft.component.date.swing.JDateComponent
JDateComponent.DateAction, JDateComponent.RollDateAction, JDateComponent.SelectFirstDayAction, JDateComponent.SelectLastDayAction, JDateComponent.SelectNoneAction, JDateComponent.SelectTodayAction
 
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  java.awt.Color calendarBackground
           
protected  java.awt.Color calendarForeground
           
protected  java.awt.Color calendarTitleBackground
           
protected  java.awt.Color calendarTitleForeground
           
protected  java.awt.Color calendarTrailingForeground
           
protected  boolean calendarVisible
           
protected  boolean displayToday
           
protected  boolean isEditable
           
protected  DateRenderer renderer
           
protected  javax.swing.table.TableCellEditor tableCellEditor
           
protected  boolean weekNumbersVisible
           
 
Fields inherited from class com.standbysoft.component.date.swing.JDateEditComponent
autoRestore, autoValidate, beepOnError, customDateFormat, dateFormat, dateModel, dateModelListener, dateParser, emptySelectionText, freeText, text
 
Fields inherited from class com.standbysoft.component.date.swing.JDateComponent
actionCommand, dateSelectionModel, dateSelectionModelListener, locale, selectFirstDayAction, selectLastDayAction, selectNextDayAction, selectNoneAction, selectPreviousDayAction, selectSameDayNextMonthAction, selectSameDayNextWeekAction, selectSameDayNextYearAction, selectSameDayPreviousMonthAction, selectSameDayPreviousWeekAction, selectSameDayPreviousYearAction, selectTodayAction
 
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
JDatePicker()
          Creates a default non-editable date picker has the today date selected.
JDatePicker(boolean editable)
          Creates a date picker with a specified editable state.
 
Method Summary
static javax.swing.table.TableCellEditor createTableCellEditor()
          Returns a JDatePicker based table cell editor.
static javax.swing.table.TableCellEditor createTableCellEditor(JDatePicker datePicker)
          Returns a JDatePicker based table cell editor.
 java.awt.Color getCalendarBackground()
          Returns the background color for the calendar.
 DateRenderer getCalendarDateRenderer()
          Returns the renderer used to display the dates in the calendar.
 java.awt.Color getCalendarForeground()
          Returns the foreground color for the calendar.
 java.awt.Color getCalendarTitleBackground()
          Returns the background color for the calendar title.
 java.awt.Color getCalendarTitleForeground()
          Returns the foreground color for the calendar title.
 java.awt.Color getCalendarTrailingForeground()
          Returns the foreground color for trailing days.
 java.lang.String getUIClassID()
          Returns the name of the L&F class that renders this component.
 boolean isCalendarDisplayToday()
          Determines whether the button that displays and selects the today date is shown.
 boolean isCalendarVisible()
          Determines the visibility of the popup calendar.
 boolean isCalendarWeekNumbersVisible()
          Determines whether the week numbers should be displayed or not.
 boolean isEditable()
          Returns whether this component is editable or not.
 void setCalendarBackground(java.awt.Color color)
          Sets the background color for the calendar.
 void setCalendarDateRenderer(DateRenderer renderer)
          Specify a renderer that will be used to display the dates in the calendar.
 void setCalendarDisplayToday(boolean show)
          Specifies whether the today button is displayed.
 void setCalendarForeground(java.awt.Color color)
          Sets the foreground color for the calendar.
 void setCalendarTitleBackground(java.awt.Color color)
          Sets the background color for the calendar title.
 void setCalendarTitleForeground(java.awt.Color color)
          Sets the foreground color for the calendar title.
 void setCalendarTrailingForeground(java.awt.Color color)
          Sets the foreground color for trailing days.
 void setCalendarVisible(boolean visible)
          Sets the visibility of the popup calendar.
 void setCalendarWeekNumbersVisible(boolean visible)
          Specifies whether the week numbers should be displayed or not.
 void setEditable(boolean editable)
          Enables dates to be typed-in or not.
 
Methods inherited from class com.standbysoft.component.date.swing.JDateEditComponent
addDateListener, commitEdit, fireDateChanged, fireDateFieldChanged, fireDateFieldCleared, getAutoCenturyYear, getCustomDateFormat, getDateFormat, getDateModel, getDateParser, getEmptySelectionText, getText, invalidEdit, isAutoCentury, isAutoRestore, isAutoValidate, isBeepOnError, isEditValid, isFreeText, removeDateListener, setAutoCentury, setAutoCenturyYear, setAutoRestore, setAutoValidate, setBeepOnError, setCustomDateFormat, setDateFormat, setDateModel, setDateParser, setDateSelectionModel, setEmptySelectionText, setFreeText, setText
 
Methods inherited from class com.standbysoft.component.date.swing.JDateComponent
addActionListener, addDateSelectionListener, fireActionEvent, fireDateSelectionChanged, fireDisabledDatesChanged, fireEmptySelectionAllowedChanged, fireSelectionModeChanged, getActionCommand, getDateSelectionModel, getLocale, getSelectedDate, getUI, isEmptySelectionAllowed, removeActionListener, removeDateSelectionListener, setActionCommand, setEmptySelectionAllowed, setLocale, setSelectedDate, setUI, updateUI
 
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, getAccessibleContext, 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, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, 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, addKeyListener, 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, 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, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, 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

calendarBackground

protected java.awt.Color calendarBackground

calendarForeground

protected java.awt.Color calendarForeground

calendarTitleBackground

protected java.awt.Color calendarTitleBackground

calendarTitleForeground

protected java.awt.Color calendarTitleForeground

calendarTrailingForeground

protected java.awt.Color calendarTrailingForeground

tableCellEditor

protected javax.swing.table.TableCellEditor tableCellEditor

isEditable

protected boolean isEditable

weekNumbersVisible

protected boolean weekNumbersVisible

displayToday

protected boolean displayToday

calendarVisible

protected boolean calendarVisible

renderer

protected DateRenderer renderer
Constructor Detail

JDatePicker

public JDatePicker()
Creates a default non-editable date picker has the today date selected. Null dates are allowed by default.


JDatePicker

public JDatePicker(boolean editable)
Creates a date picker with a specified editable state.

Parameters:
editable - true if an editable date picker should be created; false otherwise.
Method Detail

getUIClassID

public java.lang.String getUIClassID()
Returns the name of the L&F class that renders this component.

Returns:
the string "DatePickerUI"

createTableCellEditor

public static javax.swing.table.TableCellEditor createTableCellEditor()
Returns a JDatePicker based table cell editor.

Returns:
table cell editor for Date objects.

createTableCellEditor

public static javax.swing.table.TableCellEditor createTableCellEditor(JDatePicker datePicker)
Returns a JDatePicker based table cell editor.

Parameters:
datePicker - date picker that will be used to edit table objects
Returns:
table cell editor for Date objects.

setEditable

public void setEditable(boolean editable)
Enables dates to be typed-in or not.

Parameters:
editable - true if the editor should be activated; false otherwise.

isEditable

public boolean isEditable()
Returns whether this component is editable or not.

Returns:
true if the component is in editable mode, that is the editor is activated; false otherwise.

setCalendarDateRenderer

public void setCalendarDateRenderer(DateRenderer renderer)
Specify a renderer that will be used to display the dates in the calendar.

Parameters:
renderer - specified renderer that displays the dates in the calendar

getCalendarDateRenderer

public DateRenderer getCalendarDateRenderer()
Returns the renderer used to display the dates in the calendar.

Returns:
the renderer used to display the dates in the calendar.

getCalendarBackground

public java.awt.Color getCalendarBackground()
Returns the background color for the calendar.

Returns:
background color for the calendar.

setCalendarBackground

public void setCalendarBackground(java.awt.Color color)
Sets the background color for the calendar.

Parameters:
color - new color that is set.

getCalendarForeground

public java.awt.Color getCalendarForeground()
Returns the foreground color for the calendar.

Returns:
foreground color for the calendar title.

setCalendarForeground

public void setCalendarForeground(java.awt.Color color)
Sets the foreground color for the calendar.

Parameters:
color - new color that is set.

getCalendarTitleBackground

public java.awt.Color getCalendarTitleBackground()
Returns the background color for the calendar title.

Returns:
background color for the calendar title.
See Also:
setCalendarTitleBackground(Color)

setCalendarTitleBackground

public void setCalendarTitleBackground(java.awt.Color color)
Sets the background color for the calendar title. The background for the currently selected day(s), month and year is painted using this color.

Parameters:
color - new color that is set.

getCalendarTitleForeground

public java.awt.Color getCalendarTitleForeground()
Returns the foreground color for the calendar title.

Returns:
foreground color for the calendar title.
See Also:
setCalendarTitleForeground(Color)

setCalendarTitleForeground

public void setCalendarTitleForeground(java.awt.Color color)
Sets the foreground color for the calendar title. The currently selected day(s), month and year are painted using this color.

Parameters:
color - new color that is set.

getCalendarTrailingForeground

public java.awt.Color getCalendarTrailingForeground()
Returns the foreground color for trailing days.

Returns:
the foreground color for trailing days.
See Also:
setCalendarTrailingForeground(Color)

setCalendarTrailingForeground

public void setCalendarTrailingForeground(java.awt.Color color)
Sets the foreground color for trailing days. The popup of the date picker shows a one month calendar. The trailing days are the days that do not belong to that month.

Parameters:
color - new color that is set

isCalendarWeekNumbersVisible

public boolean isCalendarWeekNumbersVisible()
Determines whether the week numbers should be displayed or not.

Returns:
true if the numbers are visible; false otherwise.

setCalendarWeekNumbersVisible

public void setCalendarWeekNumbersVisible(boolean visible)
Specifies whether the week numbers should be displayed or not.

Parameters:
visible - true if the numbers are visible; false otherwise.

isCalendarDisplayToday

public boolean isCalendarDisplayToday()
Determines whether the button that displays and selects the today date is shown.

Returns:
true if the today button is displayed; false otherwise.

setCalendarDisplayToday

public void setCalendarDisplayToday(boolean show)
Specifies whether the today button is displayed.

Parameters:
show - true if it should be displayed; false otherwise.
See Also:
isCalendarDisplayToday()

isCalendarVisible

public boolean isCalendarVisible()
Determines the visibility of the popup calendar.

Returns:
true if the date picker popup calendar is visible; false otherwise.

setCalendarVisible

public void setCalendarVisible(boolean visible)
Sets the visibility of the popup calendar.

Parameters:
visible - visibility of the date picker popup calendar.

Java Date Picker v3.2

Visit www.javadatepicker.com for further information or send us your suggestions.

Copyright © 2003-2004 Stand By Soft Ltd. All Rights Reserved.