JDatePicker v4.3

com.standbysoft.component.date.swing
Class JMonth

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.JMonth
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
JMonthView

public class JMonth
extends JDateComponent

A JMonth is a convenient way of representing all the days of a month from the calendar. You can find task-oriented documentation and examples of using month components in Using a JMonth Component and Using a JMonth Component - Expert Features, two sections in The JDatePicker Suite Tutorial.

It inherits from JDateComponent which means that it uses a date selection model to restrict date selection as you need.

Although date selection can be controled using the selection model, the API has a few methods for the most frequent operations. It adds a method for selecting a set of dates and one for changing the selection type.

An important property is toggleDateSelection. It allows to control what to do when a date is clicked. By default, it is set to false.

An important part of its API is reserved for customizing its appearance. You can control:

The third and last part of the API is dedicated to the MonthModel, WeekModel interfaces which control month and week specific information. JMonth provides wrapper methods for some of their most common operations:

Because this component is only a visualization for one calendar month, you might actually want to use the more feature rich JMonthView.

The default UI delegate used by this component is DefaultMonthUI. When using this delegate, the component can be configured with some client properties that improve its behavior.

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 static long AUTOUPDATE_MILLISECONDS_24H
          Indicates the number of milliseconds in a day.
protected  boolean autoUpdateTodayEnabled
           
static java.lang.String DATE_COMMAND
          Action name that indicates a date command.
protected  int datesOrientation
           
protected  java.awt.Color gridColor
           
protected  boolean horizontalLinesVisible
           
protected  java.awt.Color monthBackground
           
protected  MonthModel monthModel
           
protected  MonthModelListener monthModelListener
          Listener that takes month model events from the model and fires them further away as events generated by this component.
protected  DateRenderer renderer
          Renderer that is used to display the dates of a month.
protected  java.awt.Color titleBackground
           
protected  java.awt.Color titleForeground
           
protected  boolean toggleDateSelectionEnabled
           
protected  java.awt.Color trailingForeground
           
protected  boolean trailingNextEnabled
           
protected  boolean trailingPreviousEnabled
           
protected  boolean verticalLinesVisible
           
protected  WeekModel weekModel
           
protected  WeekModelListener weekModelListener
          Listener that takes week model events from the model and fires them further away as events generated by this component.
protected  boolean weekNamesVisible
           
protected  boolean weekNumbersVisible
           
 
Fields inherited from class com.standbysoft.component.date.swing.JDateComponent
actionCommand, calendar, dateSelectionModel, dateSelectionModelListener, locale, selectFirstDayAction, selectLastDayAction, selectNextDayAction, selectNoneAction, selectPreviousDayAction, selectSameDayNextMonthAction, selectSameDayNextWeekAction, selectSameDayNextYearAction, selectSameDayPreviousMonthAction, selectSameDayPreviousWeekAction, selectSameDayPreviousYearAction, selectTodayAction, timeZone
 
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
JMonth()
          Creates a component that displays the days of a month.
JMonth(MonthModel model)
           
JMonth(MonthModel model, DateSelectionModel dateSelectionModel)
           
 
Method Summary
 void addMonthModelListener(MonthModelListener listener)
          Registers a month model listener that will receive notifications when the month model model changes.
 void addWeekModelListener(WeekModelListener listener)
          Registers a week model listener that will receive notifications when the week model model changes.
protected  void fireDowChanged(WeekModelEvent evt)
           
protected  void fireDowFirstChanged(WeekModelEvent evt)
           
protected  void fireDowNamesChanged(WeekModelEvent evt)
           
protected  void fireMonthChanged(MonthModelEvent evt)
           
protected  void fireMonthNamesChanged(MonthModelEvent evt)
           
protected  void fireTodayChanged(MonthModelEvent evt)
           
protected  void fireWeekChanged(WeekModelEvent evt)
           
protected  void fireWeekNumbersChanged(WeekModelEvent evt)
           
 DateRenderer getDateRenderer()
          Returns the renderer used to display the dates of the month.
 int getDatesOrientation()
          Returns how the dates of a month are displayed.
 int getDowFirst()
          Returns the first day of week.
 java.awt.Color getGridColor()
          Detrmines the color used to paint the grid.
 int getMonth()
          Returns the month displayed by this component.
 java.awt.Color getMonthBackground()
          Returns the background color for the displayed month.
 MonthModel getMonthModel()
          Returns the month model used by this component.
 java.util.Date[] getSelectedDates()
          Returns the selected dates.
 DateSelectionModel.SelectionMode getSelectionMode()
          Returns the selection mode used by this component.
 java.awt.Color getTitleBackground()
          Returns the background color for the month title.
 java.awt.Color getTitleForeground()
          Returns the foreground color for the month title.
 java.awt.Color getTrailingForeground()
          Returns the foreground color for trailing days.
 java.lang.String getUIClassID()
          Returns the name of the L&F class that renders this component.
 WeekModel getWeekModel()
          Returns the week model used by this component.
 int getYear()
          Returns the year that is displayed by this component.
 boolean isAutoUpdateToday()
          Determines whether the today date is updated automatically using an internal timer.
 boolean isDowSelectionAllowed()
          Determines whether days of week may be selected.
 boolean isHorizontalLinesVisible()
          Determines whether the horizontal lines of the grid are visible.
 boolean isToggleDateSelectionEnabled()
          Returns the value of the toggle flag that is used to determine what to do with a date when it is clicked.
 boolean isTrailingNextEnabled()
          Determines whether the trailing dates from the next month are enabled.
 boolean isTrailingPreviousEnabled()
          Determines whether the trailing dates from the previous month are enabled.
 boolean isVerticalLinesVisible()
          Determines whether the vertical lines of the grid are visible.
 boolean isWeekNamesVisible()
          Determines whether the week names are visible or not.
 boolean isWeekNumbersVisible()
          Determines whether the week numbers are visible or not.
 boolean isWeekSelectionAllowed()
          Determines whether weeks of year may be selected.
 void removeMonthModelListener(MonthModelListener listener)
          Removes a specified month model listener.
 void removeWeekModelListener(WeekModelListener listener)
          Removes a specified week model listener.
 void requestFocus()
           
 void setAutoUpdateToday(boolean enabled)
          Specifies whether the today date is updated automatically at midnight.
 void setDateRenderer(DateRenderer renderer)
          Specify a renderer that will be used to display the dates of the month.
 void setDatesOrientation(int orientation)
          Specifies if the dates of a month should be displayed horizontally or vertically.
 void setDowFirst(int dow)
          Specifies the first day of week.
 void setDowSelectionAllowed(boolean allowed)
          Specifies whether days of week may be selected.
 void setGridColor(java.awt.Color color)
          Specifies the color used to paint the grid when it is visible.
 void setHorizontalLinesVisible(boolean visible)
          Specifies whether the horizontal lines of the grid are visible.
 void setLocale(java.util.Locale locale)
          Specifies a new locale to be used by this component.
 void setMonth(int month)
          Specifies a month from the current year to be displayed by this component.
 void setMonth(int month, int year)
          Specifies the month from a specified year that is displayed by this component.
 void setMonthBackground(java.awt.Color color)
          Sets the background color for the displayed month.
 void setMonthModel(MonthModel model)
          Specifies a new month model for this component.
 void setSelectedDates(java.util.Date[] dates)
          Specifies the dates selected by this component.
 void setSelectionMode(DateSelectionModel.SelectionMode mode)
          Specifies a new selection mode to be used by this component.
 void setTimeZone(java.util.TimeZone zone)
          Overriden in order to configure the internal month model to use the new time zone.
 void setTitleBackground(java.awt.Color color)
          Sets the background color for the month title.
 void setTitleForeground(java.awt.Color color)
          Sets the foreground color for the month title.
 void setToggleDateSelectionEnabled(boolean enabled)
          Specifies the value of the toggle flag that is used to determine what to do with a date when it is clicked.
 void setTrailingForeground(java.awt.Color color)
          Sets the foreground color for trailing days.
 void setTrailingNextEnabled(boolean enabled)
          Specifies whether the trailing dates from the next month are enabled.
 void setTrailingPreviousEnabled(boolean enabled)
          Specifies whether the trailing dates from the previous month are enabled.
 void setVerticalLinesVisible(boolean visible)
          Specifies whether the vertical lines of the grid are visible.
 void setWeekModel(WeekModel model)
          Specifies a new week model for this component.
 void setWeekNamesVisible(boolean visible)
          Specifies whether the week names are visible or not.
 void setWeekNumbersVisible(boolean visible)
          Specifies whether the week numbers are visible or not.
 void setWeekSelectionAllowed(boolean allowed)
          Specifies whether weeks of year may be selected.
 void setYear(int year)
          Specifies the year that is displayed by this component.
 
Methods inherited from class com.standbysoft.component.date.swing.JDateComponent
addActionListener, addDateSelectionListener, fireActionEvent, fireDateSelectionChanged, fireDisabledDatesChanged, fireDisabledDateSelectionAttempted, fireEmptySelectionAllowedChanged, fireSelectionModeChanged, getActionCommand, getCalendar, getDateSelectionModel, getLocale, getSelectedDate, getTimeZone, getUI, isEmptySelectionAllowed, removeActionListener, removeDateSelectionListener, setActionCommand, setDateSelectionModel, setEmptySelectionAllowed, 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, 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

DATE_COMMAND

public static final java.lang.String DATE_COMMAND
Action name that indicates a date command. An date command is issued when a date is double clicked.

See Also:
Constant Field Values

monthModelListener

protected MonthModelListener monthModelListener
Listener that takes month model events from the model and fires them further away as events generated by this component.


weekModelListener

protected WeekModelListener weekModelListener
Listener that takes week model events from the model and fires them further away as events generated by this component.


renderer

protected DateRenderer renderer
Renderer that is used to display the dates of a month.


AUTOUPDATE_MILLISECONDS_24H

protected static final long AUTOUPDATE_MILLISECONDS_24H
Indicates the number of milliseconds in a day. This is the rate used by the auto update timer to update the calendar that indicates the today date.

See Also:
Constant Field Values

monthModel

protected MonthModel monthModel

weekModel

protected WeekModel weekModel

monthBackground

protected java.awt.Color monthBackground

titleBackground

protected java.awt.Color titleBackground

titleForeground

protected java.awt.Color titleForeground

trailingForeground

protected java.awt.Color trailingForeground

gridColor

protected java.awt.Color gridColor

weekNumbersVisible

protected boolean weekNumbersVisible

weekNamesVisible

protected boolean weekNamesVisible

horizontalLinesVisible

protected boolean horizontalLinesVisible

verticalLinesVisible

protected boolean verticalLinesVisible

trailingPreviousEnabled

protected boolean trailingPreviousEnabled

trailingNextEnabled

protected boolean trailingNextEnabled

toggleDateSelectionEnabled

protected boolean toggleDateSelectionEnabled

autoUpdateTodayEnabled

protected boolean autoUpdateTodayEnabled

datesOrientation

protected int datesOrientation
Constructor Detail

JMonth

public JMonth()
Creates a component that displays the days of a month.


JMonth

public JMonth(MonthModel model)

JMonth

public JMonth(MonthModel model,
              DateSelectionModel dateSelectionModel)
Method Detail

setAutoUpdateToday

public void setAutoUpdateToday(boolean enabled)

Specifies whether the today date is updated automatically at midnight. This is important especially if the application runs over night. By default it is disabled. If enabled, an internal timer task is created and started.

Parameters:
enabled - true if the today date should be updated automatically at midnight using an internal timer; false otherwise
See Also:
MonthModel.setToday(Date)

isAutoUpdateToday

public boolean isAutoUpdateToday()
Determines whether the today date is updated automatically using an internal timer.

Returns:
true if the today date is updated automatically at midnight; false otherwise

requestFocus

public void requestFocus()

addMonthModelListener

public void addMonthModelListener(MonthModelListener listener)
Registers a month model listener that will receive notifications when the month model model changes. Perhaps one of the main reasons is to be notified when the month displayed by this component changes.

Parameters:
listener - listener that is registered
See Also:
setMonthModel(MonthModel), removeMonthModelListener(MonthModelListener)

removeMonthModelListener

public void removeMonthModelListener(MonthModelListener listener)
Removes a specified month model listener. It will not receive month model events anymore.

Parameters:
listener - removed listener

addWeekModelListener

public void addWeekModelListener(WeekModelListener listener)
Registers a week model listener that will receive notifications when the week model model changes.

Parameters:
listener - listener that is registered
See Also:
setWeekModel(WeekModel), removeWeekModelListener(WeekModelListener)

removeWeekModelListener

public void removeWeekModelListener(WeekModelListener listener)
Removes a specified week model listener. It will not receive week model events anymore.

Parameters:
listener - removed listener

getMonthModel

public MonthModel getMonthModel()
Returns the month model used by this component.

Returns:
month model used by this component.

setMonthModel

public void setMonthModel(MonthModel model)
Specifies a new month model for this component. The month model is useful to define month specific information like: current month, first day of week, etc.

Parameters:
model - new month model to be used by this component

getWeekModel

public WeekModel getWeekModel()
Returns the week model used by this component.

Returns:
week model used by this component.

setWeekModel

public void setWeekModel(WeekModel model)
Specifies a new week model for this component. The week model is useful to define week specific information like: first day of week, week day names, etc.

Parameters:
model - new week model to be used by this component

setDateRenderer

public void setDateRenderer(DateRenderer renderer)
Specify a renderer that will be used to display the dates of the month.

Parameters:
renderer - specified renderer that displays the dates of the month

getDateRenderer

public DateRenderer getDateRenderer()
Returns the renderer used to display the dates of the month.

Returns:
the renderer used to display the dates of the month.

getUIClassID

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

Returns:
the string "MonthUI"

isDowSelectionAllowed

public boolean isDowSelectionAllowed()
Determines whether days of week may be selected.

Returns:
true if days of week may be selected and false otherwise
See Also:
WeekModel.isDowSelectionAllowed()

setDowSelectionAllowed

public void setDowSelectionAllowed(boolean allowed)
Specifies whether days of week may be selected. A day of week may be selected from a JMonth component if the respective day is clicked in the header.

Parameters:
allowed - if true, one may click on a day of week to select it.
See Also:
WeekModel.setDowSelectionAllowed(boolean)

isWeekSelectionAllowed

public boolean isWeekSelectionAllowed()
Determines whether weeks of year may be selected.

Returns:
true if weeks of week may be selected and false otherwise
See Also:
WeekModel.isWeekSelectionAllowed()

setWeekSelectionAllowed

public void setWeekSelectionAllowed(boolean allowed)
Specifies whether weeks of year may be selected. A week of year may be selected from a JMonth component if the respective week number is clicked.

Parameters:
allowed - if true, one may click on a week of year to select it.
See Also:
WeekModel.setWeekSelectionAllowed(boolean)

getDowFirst

public int getDowFirst()
Returns the first day of week.

Returns:
the first day of week.
See Also:
WeekModel.getDowFirst()

setDowFirst

public void setDowFirst(int dow)
Specifies the first day of week.

Parameters:
dow - day of week that is a java.util.Calendar constant like Calendar.MONDAY
See Also:
WeekModel.setDowFirst(int)

setMonth

public void setMonth(int month)
Specifies a month from the current year to be displayed by this component. The values are those specified by java.util.Calendar.

Parameters:
month -
See Also:
MonthModel.setMonth(int), setMonth(int, int)

setMonth

public void setMonth(int month,
                     int year)
Specifies the month from a specified year that is displayed by this component. The values are those specified by java.util.Calendar.

Parameters:
month -
year -
See Also:
MonthModel.setMonth(int, int), setMonth(int), setYear(int)

getMonth

public int getMonth()
Returns the month displayed by this component.

Returns:
the month displayed by this component.
See Also:
MonthModel.getMonth(), getYear()

setYear

public void setYear(int year)
Specifies the year that is displayed by this component.

Parameters:
year - year that is displayed by this component.
See Also:
MonthModel.setYear(int)

getYear

public int getYear()
Returns the year that is displayed by this component.

Returns:
year that is displayed by this component.
See Also:
MonthModel.getYear(), getMonth()

setLocale

public void setLocale(java.util.Locale locale)
Specifies a new locale to be used by this component. The locale is very important because it is used to get the right names for the week days and to the first day of week.

Overrides:
setLocale in class JDateComponent
Parameters:
locale - locale to be used by this component

isTrailingNextEnabled

public boolean isTrailingNextEnabled()
Determines whether the trailing dates from the next month are enabled. When these dates are disabled, they are not displayed.

Returns:
true if the trailing dates are enabled; false otherwise

setTrailingNextEnabled

public void setTrailingNextEnabled(boolean enabled)
Specifies whether the trailing dates from the next month are enabled. When these dates are disabled, they are not displayed.

Parameters:
enabled - true to enable; false to disable

isTrailingPreviousEnabled

public boolean isTrailingPreviousEnabled()
Determines whether the trailing dates from the previous month are enabled. When these dates are disabled, they are not displayed.

Returns:
true if the trailing dates are enabled; false otherwise

setTrailingPreviousEnabled

public void setTrailingPreviousEnabled(boolean enabled)
Specifies whether the trailing dates from the previous month are enabled. When these dates are disabled, they are not displayed.

Parameters:
enabled - true to enable; false to disable

isWeekNumbersVisible

public boolean isWeekNumbersVisible()
Determines whether the week numbers are visible or not.

Returns:
true if the week numbers are visible or false otherwise.

setWeekNumbersVisible

public void setWeekNumbersVisible(boolean visible)
Specifies whether the week numbers are visible or not.

Parameters:
visible - visibility of the week numbers

getDatesOrientation

public int getDatesOrientation()
Returns how the dates of a month are displayed.

Returns:
SwingConstants.HORIZONTAL or SwingConstants.VERTICAL
See Also:
setDatesOrientation(int)

setDatesOrientation

public void setDatesOrientation(int orientation)
Specifies if the dates of a month should be displayed horizontally or vertically. Depending on this orientation, the week numbers and the names of the week days will also be displayed differently. By default, the dates are displayed horizontally.

Parameters:
orientation - SwingConstants.HORIZONTAL or SwingConstants.VERTICAL
Throws:
java.lang.IllegalArgumentException - if orientation is not one of VERTICAL, HORIZONTAL

isWeekNamesVisible

public boolean isWeekNamesVisible()
Determines whether the week names are visible or not.

Returns:
true if the week names are visible or false otherwise.

setWeekNamesVisible

public void setWeekNamesVisible(boolean visible)
Specifies whether the week names are visible or not.

Parameters:
visible - visibility of the week names

isHorizontalLinesVisible

public boolean isHorizontalLinesVisible()
Determines whether the horizontal lines of the grid are visible.

Returns:
true if the horizontal line are visible; false otherwise
See Also:
setHorizontalLinesVisible(boolean)

setHorizontalLinesVisible

public void setHorizontalLinesVisible(boolean visible)
Specifies whether the horizontal lines of the grid are visible.

Parameters:
visible - true if the lines should be visible; false otherwise
See Also:
setVerticalLinesVisible(boolean), setGridColor(Color)

isVerticalLinesVisible

public boolean isVerticalLinesVisible()
Determines whether the vertical lines of the grid are visible.

Returns:
true if the vertical line are visible; false otherwise
See Also:
setVerticalLinesVisible(boolean)

setVerticalLinesVisible

public void setVerticalLinesVisible(boolean visible)
Specifies whether the vertical lines of the grid are visible.

Parameters:
visible - true if the lines should be visible; false otherwise
See Also:
setHorizontalLinesVisible(boolean), setGridColor(Color)

getGridColor

public java.awt.Color getGridColor()
Detrmines the color used to paint the grid.

Returns:
the color used to paint the grid.
See Also:
setGridColor(Color)

setGridColor

public void setGridColor(java.awt.Color color)
Specifies the color used to paint the grid when it is visible.

Parameters:
color - color used to paint the grid
See Also:
setHorizontalLinesVisible(boolean), setVerticalLinesVisible(boolean)

getTitleBackground

public java.awt.Color getTitleBackground()
Returns the background color for the month title.

Returns:
background color for the month title.
See Also:
setTitleBackground(Color)

setTitleBackground

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

Parameters:
color - new color that is set.
See Also:
setDateRenderer(DateRenderer)

getTitleForeground

public java.awt.Color getTitleForeground()
Returns the foreground color for the month title.

Returns:
foreground color for the month title.
See Also:
setTitleForeground(Color)

setTitleForeground

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

Parameters:
color - new color that is set.
See Also:
setDateRenderer(DateRenderer)

getTrailingForeground

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

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

setTrailingForeground

public void setTrailingForeground(java.awt.Color color)
Sets the foreground color for trailing days. The trailing days are the days that do not belong to the displayed month.

Parameters:
color - new color that is set
See Also:
setDateRenderer(DateRenderer)

getMonthBackground

public java.awt.Color getMonthBackground()
Returns the background color for the displayed month.

Returns:
background color for the displayed month
See Also:
setMonthBackground(Color)

setMonthBackground

public void setMonthBackground(java.awt.Color color)
Sets the background color for the displayed month.

Parameters:
color - new color that is set
See Also:
setDateRenderer(DateRenderer)

setToggleDateSelectionEnabled

public void setToggleDateSelectionEnabled(boolean enabled)

Specifies the value of the toggle flag that is used to determine what to do with a date when it is clicked.

This feature is especially useful when you want to select multiple dates but you do not want to use the CTRL + mouse click to do that. Enabling this property has the same effect as holding down the CTRL key.

Parameters:
enabled - new value for the toggle flag. If true, clicked dates just toggle their state from selected to unselected and conversely. If false, clicking on a date means that it is the only selected date.

isToggleDateSelectionEnabled

public boolean isToggleDateSelectionEnabled()
Returns the value of the toggle flag that is used to determine what to do with a date when it is clicked.

Returns:
value of the toggle flag
See Also:
setToggleDateSelectionEnabled(boolean)

getSelectedDates

public java.util.Date[] getSelectedDates()
Returns the selected dates. Depending on the selection mode, zero, one or more dates are returned. There can be returned zero dates when empty date selection is allowed.

Returns:
the selected dates; the array can be empty when empty selection is allowed
See Also:
JDateComponent.setEmptySelectionAllowed(boolean)

setSelectedDates

public void setSelectedDates(java.util.Date[] dates)
Specifies the dates selected by this component.

Parameters:
dates - array of dates selected by this component. If the array is empty, no date will be selected.
See Also:
getSelectedDates(), setSelectionMode(com.standbysoft.component.date.DateSelectionModel.SelectionMode)

getSelectionMode

public DateSelectionModel.SelectionMode getSelectionMode()
Returns the selection mode used by this component.

Returns:
the selection mode used by this component.

setSelectionMode

public void setSelectionMode(DateSelectionModel.SelectionMode mode)
Specifies a new selection mode to be used by this component. The selection mode tells whether a single date, a date interval or multiple date intervals can be selected.

Parameters:
mode - selection mode to be used by this component
See Also:
JDateComponent.setEmptySelectionAllowed(boolean)

setTimeZone

public void setTimeZone(java.util.TimeZone zone)
Overriden in order to configure the internal month model to use the new time zone.

Overrides:
setTimeZone in class JDateComponent
Parameters:
zone - new time zone for this component

fireMonthChanged

protected void fireMonthChanged(MonthModelEvent evt)

fireMonthNamesChanged

protected void fireMonthNamesChanged(MonthModelEvent evt)

fireTodayChanged

protected void fireTodayChanged(MonthModelEvent evt)

fireDowNamesChanged

protected void fireDowNamesChanged(WeekModelEvent evt)

fireDowFirstChanged

protected void fireDowFirstChanged(WeekModelEvent evt)

fireDowChanged

protected void fireDowChanged(WeekModelEvent evt)

fireWeekChanged

protected void fireWeekChanged(WeekModelEvent evt)

fireWeekNumbersChanged

protected void fireWeekNumbersChanged(WeekModelEvent evt)

JDatePicker v4.3

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

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