Class DatePickerSettings
java.lang.Object
com.github.lgooddatepicker.components.DatePickerSettings
DatePickerSettings, This holds all the settings that can be customized for a DatePicker (or an
independent CalendarPanel).
A DatePickerSettings instance may be (optionally) created, customized, and passed to the date
picker constructor. If no settings instance is supplied when a date picker is constructed, then a
settings instance with default settings is automatically generated and used by the date picker
class.
Each and all of the setting fields are set to a default value when a DatePickerSettings object is
constructed. This means that the programmer does not need to overwrite all (or any) of the
available settings to use this class. They only need to change any particular settings that they
wish to customize.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
DateArea, These enumerations represent areas of the components whose color can be changed. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with Default Locale, This constructs a date picker settings instance using the system default locale and language.DatePickerSettings
(Locale pickerLocale) Constructor with Custom Locale, This constructs a date picker settings instance using the supplied locale and language. -
Method Summary
Modifier and TypeMethodDescriptioncopySettings, This function creates and returns a deep copy of this DatePickerSettings instance.boolean
getAllowEmptyDates, Returns the value of this setting.boolean
getAllowKeyboardEditing, Returns the value of this setting.getBorderCalendarPopup, Returns the value of this setting.getBorderPropertiesList, Returns the value of this setting.getClock()
getClock, Returns the currently set clockgetColor, This returns the currently set color for the specified area.getColorBackgroundWeekdayLabels, Returns the value of this setting.getColorBackgroundWeekNumberLabels, Returns the value of this setting.getDateRangeLimits, This will return a DateInterval containing any current date range limits.getDefaultYearMonth, This returns the defaultYearMonth or null.boolean
getEnableMonthMenu, Returns the value of this setting.boolean
getEnableYearMenu, Returns the value of this setting.getFirstDayOfWeekDisplayedOnCalendar, Returns the first day of the week as it will be displayed on the calendar.getFirstDayOfWeekSetting, Returns the value of of the setting for the first day of the week.getFontCalendarDateLabels, Returns the value of this setting.getFontCalendarWeekdayLabels, Returns the value of this setting.getFontCalendarWeekNumberLabels, Returns the value of this setting.getFontClearLabel, Returns the value of this setting.getFontInvalidDate, Returns the value of this setting.getFontMonthAndYearMenuLabels, Returns the value of this setting.getFontMonthAndYearNavigationButtons, Returns the value of this setting.getFontTodayLabel, Returns the value of this setting.getFontValidDate, Returns the value of this setting.getFontVetoedDate, Returns the value of this setting.getFormatForDatesBeforeCommonEra, Returns the value of this setting.getFormatForDatesCommonEra, Returns the value of this setting.getFormatForTodayButton, Returns the value of this setting.getFormatsForParsing, Returns the value of this setting.getGapBeforeButtonPixels, Returns the value of this setting.getHighlightPolicy, This returns the highlight policy or null.getLocale, This returns locale setting of the date picker.getParentCalendarPanel, Returns the calendar panel that is the parent of the settings, or null if no parent calendar panel has been set.getParentDatePicker, Returns the date picker that is the parent of the settings, or null if no parent date picker has been set.int
getSizeDatePanelMinimumHeight, Returns the value of this setting.int
getSizeDatePanelMinimumWidth, Returns the value of this setting.getSizeTextFieldMinimumWidth, Returns the value of this setting.boolean
getSizeTextFieldMinimumWidthDefaultOverride, Returns the value of this setting.String[]
getTranslationArrayStandaloneLongMonthNames, Returns the value of this setting.String[]
getTranslationArrayStandaloneShortMonthNames, Returns the value of this setting.getTranslationClear, Returns the value of this setting.getTranslationToday, Returns the value of this setting.getVetoPolicy, This returns the veto policy or null.boolean
getVisibleClearButton, This returns the visibility state of the named component.boolean
getVisibleDateTextField, This returns the visibility state of the named component.boolean
getVisibleMonthMenuButton, This returns the visibility state of the named component.boolean
getVisibleNextMonthButton, This returns the visibility state of the named component.boolean
getVisibleNextYearButton, This returns the visibility state of the named component.boolean
getVisiblePreviousMonthButton, This returns the visibility state of the named component.boolean
getVisiblePreviousYearButton, This returns the visibility state of the named component.boolean
getVisibleTodayButton, This returns the visibility state of the named component.boolean
getVisibleYearMenuButton, This returns the visibility state of the named component.getWeekNumberRules, Returns the value of this setting.boolean
getWeekNumbersDisplayed, Returns the value of this setting.boolean
getWeekNumbersWillOverrideFirstDayOfWeek, Returns the value of this setting.boolean
hasParent, This returns true if this settings instance has a parent, otherwise returns false.boolean
isDateAllowed
(LocalDate date) isDateAllowed, This checks to see if the specified date is allowed by any currently set veto policy, and allowed by the current setting of allowEmptyDates.void
setAllowEmptyDates
(boolean allowEmptyDates) setAllowEmptyDates, This sets whether or not empty dates (null dates) are allowed in the DatePicker or independent CalendarPanel.void
setAllowKeyboardEditing
(boolean allowKeyboardEditing) setAllowKeyboardEditing, This sets whether or not keyboard editing is allowed for this date picker.void
setBorderCalendarPopup
(Border borderCalendarPopup) setBorderCalendarPopup, This sets the border for the calendar popup window.void
setBorderPropertiesList
(ArrayList<CalendarBorderProperties> borderPropertiesList) setBorderPropertiesList, This sets the list of border properties objects that specifies the colors and thicknesses of the borders in the CalendarPanel.void
setClock, This sets the clock to use for determining the current date.void
setColor
(DatePickerSettings.DateArea area, Color color) setColor, This sets a color for the specified area.void
setColorBackgroundWeekdayLabels
(Color colorBackgroundWeekdayLabels, boolean applyMatchingDefaultBorders) setColorBackgroundWeekdayLabels, This sets the calendar background color for the weekday labels.void
setColorBackgroundWeekNumberLabels
(Color colorBackgroundWeekNumberLabels, boolean applyMatchingDefaultBorders) setColorBackgroundWeekNumberLabels, This sets the calendar background color for the week number labels.boolean
setDateRangeLimits
(LocalDate firstAllowedDate, LocalDate lastAllowedDate) setDateRangeLimits, This is a convenience function, for setting a DateVetoPolicy that will limit the allowed dates in the parent object to a specified minimum and maximum date value.void
setDefaultYearMonth
(YearMonth defaultYearMonth) setDefaultYearMonth, This sets which YearMonth should be displayed by default, when no date is currently selected.void
setEnableMonthMenu
(boolean enableMonthMenu) setEnableMonthMenu, This sets the month popup menu to be enabled or disabled.void
setEnableYearMenu
(boolean enableYearMenu) setEnableYearMenu, This sets the year popup menu to be enabled or disabled.void
setFirstDayOfWeek
(DayOfWeek firstDayOfWeek) setFirstDayOfWeek, This sets the day of the week that will be displayed in the far left column of the CalendarPanel, as the "first day of the week".void
setFontCalendarDateLabels
(Font fontCalendarDateLabels) setFontCalendarDateLabels, This sets the font for the date numbers in the calendar panel.void
setFontCalendarWeekdayLabels
(Font fontCalendarWeekdayLabels) setFontCalendarWeekdayLabels, This sets the font for the weekday labels in the calendar panel.void
setFontCalendarWeekNumberLabels
(Font fontCalendarWeekNumberLabels) setFontCalendarWeekNumberLabels, This sets the font for the week numbers in the calendar panel.void
setFontClearLabel
(Font fontClearLabel) setFontClearLabel, This sets the font for the clear label, (this also acts as a "button"), in the calendar panel.void
setFontInvalidDate
(Font fontInvalidDate) setFontInvalidDate, This sets the text field text font for invalid dates.void
setFontMonthAndYearMenuLabels
(Font fontMonthAndYearMenuLabels) setFontMonthAndYearMenuLabels, This sets the font for the (two) month and year menu labels (these also act as "buttons") in the calendar panel.void
setFontMonthAndYearNavigationButtons
(Font fontMonthAndYearNavigationButtons) setFontMonthAndYearNavigationButtons, This sets the font for the (four) month any year navigation buttons in the calendar panel.void
setFontTodayLabel
(Font fontTodayLabel) setFontTodayLabel, This sets the font for the today label, (this also acts as a "button"), in the calendar panel.void
setFontValidDate
(Font fontValidDate) setFontValidDate, This sets the text field text font for valid dates.void
setFontVetoedDate
(Font fontVetoedDate) setFontVetoedDate, This sets the text field text font for vetoed dates.void
setFormatForDatesBeforeCommonEra
(String patternString) setFormatForDatesBeforeCommonEra, This sets the format that is used to display or parse BCE dates in the date picker, from a DateTimeFormatter pattern string.void
setFormatForDatesBeforeCommonEra
(DateTimeFormatter formatForDatesBeforeCommonEra) setFormatForDatesBeforeCommonEra, This sets the format that is used to display or parse BCE dates in the date picker, from a DateTimeFormatter instance.void
setFormatForDatesCommonEra
(String patternString) setFormatForDatesCommonEra, This sets the format that is used to display or parse CE dates in the date picker, from a DateTimeFormatter pattern string.void
setFormatForDatesCommonEra
(DateTimeFormatter formatForDatesCommonEra) setFormatForDatesCommonEra, This sets the format that is used to display or parse CE dates in the date picker, from a DateTimeFormatter instance.void
setFormatForTodayButton
(DateTimeFormatter formatForTodayButton) setFormatForTodayButton, This sets the format that is used to format today's date into a date string, which is displayed on the today button.void
setFormatsForParsing
(ArrayList<DateTimeFormatter> formatsForParsing) setFormatsForParsing, This holds a list of formats that are used to attempt to parse dates that are typed by the user.void
setGapBeforeButtonPixels
(Integer gapBeforeButtonPixels) setGapBeforeButtonPixels, This specifies the desired width for the gap between the date picker and the toggle calendar button (in pixels).void
setHighlightPolicy
(DateHighlightPolicy highlightPolicy) setHighlightPolicy, This sets a highlight policy for the parent DatePicker or parent independent CalendarPanel.void
setLocale, This will set the locale for this DatePickerSettings instance, and will set all other settings that depend on the locale to their default values.void
setSizeDatePanelMinimumHeight
(int sizeDatePanelMinimumHeight) setSizeDatePanelMinimumHeight, This sets the minimum height, in pixels, of the date label area.void
setSizeDatePanelMinimumWidth
(int sizeDatePanelMinimumWidth) setSizeDatePanelMinimumWidth, This sets the minimum width, in pixels, of the date label area.void
setSizeTextFieldMinimumWidth
(Integer minimumWidthInPixels) setSizeTextFieldMinimumWidth, This sets the minimum width in pixels, of the DatePicker text field.void
setSizeTextFieldMinimumWidthDefaultOverride
(boolean defaultShouldOverrideIfNeeded) setSizeTextFieldMinimumWidthDefaultOverride, This specifies how the date picker should choose the appropriate minimum width for the date picker text field.void
setTranslationArrayStandaloneLongMonthNames
(String[] newTranslationArray) setTranslationArrayStandaloneLongMonthNames, This sets an array of month names to use for the calendar panel header, as translated to the current language.void
setTranslationArrayStandaloneShortMonthNames
(String[] newTranslationArray) setTranslationArrayStandaloneShortMonthNames, This sets an array of short month names to use for the calendar panel header, as translated to the current language.void
setTranslationClear
(String translationClear) setTranslationClear, This sets the text of the calendars "Clear" button, as translated to the current language.void
setTranslationToday
(String translationToday) setTranslationToday, This sets the text of the calendars "Today" button, as translated to the current language.boolean
setVetoPolicy
(DateVetoPolicy vetoPolicy) setVetoPolicy, This sets a veto policy for the parent DatePicker or parent independent CalendarPanel.void
setVisibleClearButton
(boolean isVisible) setVisibleClearButton, This sets the visibility of the named component.void
setVisibleDateTextField
(boolean isVisible) setVisibleDateTextField, This sets the visibility of the DatePicker text field.void
setVisibleMonthMenuButton
(boolean isVisible) setVisibleMonthMenuButton, This sets the visibility of the named component.void
setVisibleNextMonthButton
(boolean isVisible) setVisibleNextMonthButton, This sets the visibility of the named component.void
setVisibleNextYearButton
(boolean isVisible) setVisibleNextYearButton, This sets the visibility of the named component.void
setVisiblePreviousMonthButton
(boolean isVisible) setVisiblePreviousMonthButton, This sets the visibility of the named component.void
setVisiblePreviousYearButton
(boolean isVisible) setVisiblePreviousYearButton, This sets the visibility of the named component.void
setVisibleTodayButton
(boolean isVisible) setVisibleTodayButton, This sets the visibility of the named component.void
setVisibleYearMenuButton
(boolean isVisible) setVisibleYearMenuButton, This sets the visibility of the named component.void
setWeekNumberRules
(WeekFields weekNumberRules) setWeekNumberRules, This sets the week number rules that will be used to show the week numbers (the weeks of the year), whenever the week numbers are displayed on this calendar.void
setWeekNumbersDisplayed
(boolean weekNumbersDisplayed, boolean applyMatchingDefaultBorders) setWeekNumbersDisplayed, This specifies whether or not numbers for the "week of the year" should be displayed on the calendar panel.void
setWeekNumbersWillOverrideFirstDayOfWeek
(boolean weekNumbersWillOverrideFirstDayOfWeek) setWeekNumbersWillOverrideFirstDayOfWeek, This setting determines how to resolve any conflict between the "weekNumberRules" setting and the "firstDayOfWeek" setting.
-
Constructor Details
-
DatePickerSettings
public DatePickerSettings()Constructor with Default Locale, This constructs a date picker settings instance using the system default locale and language. The constructor populates all the settings with default values. -
DatePickerSettings
Constructor with Custom Locale, This constructs a date picker settings instance using the supplied locale and language. The constructor populates all the settings with default values.
-
-
Method Details
-
copySettings
copySettings, This function creates and returns a deep copy of this DatePickerSettings instance. The new settings instance can be used with new DatePicker or CalendarPanel instances. Certain fields are not copied, which are listed below. These fields are not copied: parentDatePicker, parentCalendarPanel, borderCalendarPopup, vetoPolicy, and highlightPolicy. These fields are always set to their default value in the returned settings instance. (The default value for all of these fields is null.) If you would like to set any of the fields that are not copied, then you should set the desired fields after calling copySettings(). -
getAllowEmptyDates
public boolean getAllowEmptyDates()getAllowEmptyDates, Returns the value of this setting. See the "set" function for setting information. -
getAllowKeyboardEditing
public boolean getAllowKeyboardEditing()getAllowKeyboardEditing, Returns the value of this setting. See the "set" function for setting information. -
getBorderCalendarPopup
getBorderCalendarPopup, Returns the value of this setting. See the "set" function for setting information. -
getBorderPropertiesList
getBorderPropertiesList, Returns the value of this setting. See the "set" function for setting information. -
getClock
getClock, Returns the currently set clock -
getColor
getColor, This returns the currently set color for the specified area. -
getColorBackgroundWeekNumberLabels
getColorBackgroundWeekNumberLabels, Returns the value of this setting. See the "set" function for setting information. -
getColorBackgroundWeekdayLabels
getColorBackgroundWeekdayLabels, Returns the value of this setting. See the "set" function for setting information. -
getDateRangeLimits
getDateRangeLimits, This will return a DateInterval containing any current date range limits. If no date range limits have been set, then this will return an empty DateInterval. (Both dates in the DateInterval will be null). If only one side of the date range limits was set, then the other date in the DateInterval will be null. Technical Notes: This will return any date range limits that were specifically created by calling "setDateRangeLimits()". Date range limits are internally implemented using a DateVetoPolicy. (Specifically using the class "DateVetoPolicyMinimumMaximumDate".) If setDateRangeLimits was never called, or if (for any reason) the current veto policy is not an instance of "DateVetoPolicyMinimumMaximumDate", then this will return an empty DateInterval. For additional details, see setDateRangeLimits(). -
getDefaultYearMonth
getDefaultYearMonth, This returns the defaultYearMonth or null. -
getEnableMonthMenu
public boolean getEnableMonthMenu()getEnableMonthMenu, Returns the value of this setting. See the "set" function for setting information. -
getEnableYearMenu
public boolean getEnableYearMenu()getEnableYearMenu, Returns the value of this setting. See the "set" function for setting information. -
getFirstDayOfWeekDisplayedOnCalendar
getFirstDayOfWeekDisplayedOnCalendar, Returns the first day of the week as it will be displayed on the calendar. Note that this setting may or may not match the first day of the week setting. See also: "weekNumbersDisplayed", and "weekNumbersForceFirstDayOfWeekToMatch". -
getFirstDayOfWeekSetting
getFirstDayOfWeekSetting, Returns the value of of the setting for the first day of the week. Note that this setting may or may not match the first day of the week that is displayed on the calendar. See also: "weekNumbersDisplayed", and "weekNumbersForceFirstDayOfWeekToMatch". -
getFontCalendarDateLabels
getFontCalendarDateLabels, Returns the value of this setting. See the "set" function for setting information. -
getFontCalendarWeekNumberLabels
getFontCalendarWeekNumberLabels, Returns the value of this setting. See the "set" function for setting information. -
getFontCalendarWeekdayLabels
getFontCalendarWeekdayLabels, Returns the value of this setting. See the "set" function for setting information. -
getFontClearLabel
getFontClearLabel, Returns the value of this setting. See the "set" function for setting information. -
getFontInvalidDate
getFontInvalidDate, Returns the value of this setting. See the "set" function for setting information. -
getFontMonthAndYearMenuLabels
getFontMonthAndYearMenuLabels, Returns the value of this setting. See the "set" function for setting information. -
getFontTodayLabel
getFontTodayLabel, Returns the value of this setting. See the "set" function for setting information. -
getFontValidDate
getFontValidDate, Returns the value of this setting. See the "set" function for setting information. -
getFontVetoedDate
getFontVetoedDate, Returns the value of this setting. See the "set" function for setting information. -
getFormatForDatesBeforeCommonEra
getFormatForDatesBeforeCommonEra, Returns the value of this setting. See the "set" function for setting information. -
getFormatForDatesCommonEra
getFormatForDatesCommonEra, Returns the value of this setting. See the "set" function for setting information. -
getFormatForTodayButton
getFormatForTodayButton, Returns the value of this setting. See the "set" function for setting information. -
getFormatsForParsing
getFormatsForParsing, Returns the value of this setting. See the "set" function for setting information. -
getGapBeforeButtonPixels
getGapBeforeButtonPixels, Returns the value of this setting. See the "set" function for setting information. -
getHighlightPolicy
getHighlightPolicy, This returns the highlight policy or null. -
getLocale
getLocale, This returns locale setting of the date picker. The locale can only be set in the DatePickerSettings constructor. -
getParentCalendarPanel
getParentCalendarPanel, Returns the calendar panel that is the parent of the settings, or null if no parent calendar panel has been set. -
getParentDatePicker
getParentDatePicker, Returns the date picker that is the parent of the settings, or null if no parent date picker has been set. -
getSizeDatePanelMinimumHeight
public int getSizeDatePanelMinimumHeight()getSizeDatePanelMinimumHeight, Returns the value of this setting. See the "set" function for setting information. -
getSizeDatePanelMinimumWidth
public int getSizeDatePanelMinimumWidth()getSizeDatePanelMinimumWidth, Returns the value of this setting. See the "set" function for setting information. -
getSizeTextFieldMinimumWidth
getSizeTextFieldMinimumWidth, Returns the value of this setting. See the "set" function for setting information. -
getSizeTextFieldMinimumWidthDefaultOverride
public boolean getSizeTextFieldMinimumWidthDefaultOverride()getSizeTextFieldMinimumWidthDefaultOverride, Returns the value of this setting. See the "set" function for setting information. -
getTranslationArrayStandaloneLongMonthNames
getTranslationArrayStandaloneLongMonthNames, Returns the value of this setting. See the "set" function for setting information. -
getTranslationArrayStandaloneShortMonthNames
getTranslationArrayStandaloneShortMonthNames, Returns the value of this setting. See the "set" function for setting information. -
getTranslationClear
getTranslationClear, Returns the value of this setting. See the "set" function for setting information. -
getTranslationToday
getTranslationToday, Returns the value of this setting. See the "set" function for setting information. -
getVetoPolicy
getVetoPolicy, This returns the veto policy or null. -
getVisibleClearButton
public boolean getVisibleClearButton()getVisibleClearButton, This returns the visibility state of the named component. -
getVisibleDateTextField
public boolean getVisibleDateTextField()getVisibleDateTextField, This returns the visibility state of the named component. -
getVisibleMonthMenuButton
public boolean getVisibleMonthMenuButton()getVisibleMonthMenuButton, This returns the visibility state of the named component. -
getVisibleNextMonthButton
public boolean getVisibleNextMonthButton()getVisibleNextMonthButton, This returns the visibility state of the named component. -
getVisibleNextYearButton
public boolean getVisibleNextYearButton()getVisibleNextYearButton, This returns the visibility state of the named component. -
getVisiblePreviousMonthButton
public boolean getVisiblePreviousMonthButton()getVisiblePreviousMonthButton, This returns the visibility state of the named component. -
getVisiblePreviousYearButton
public boolean getVisiblePreviousYearButton()getVisiblePreviousYearButton, This returns the visibility state of the named component. -
getVisibleTodayButton
public boolean getVisibleTodayButton()getVisibleTodayButton, This returns the visibility state of the named component. -
getVisibleYearMenuButton
public boolean getVisibleYearMenuButton()getVisibleYearMenuButton, This returns the visibility state of the named component. -
getWeekNumberRules
getWeekNumberRules, Returns the value of this setting. See the "set" function for setting information. -
getWeekNumbersDisplayed
public boolean getWeekNumbersDisplayed()getWeekNumbersDisplayed, Returns the value of this setting. See the "set" function for setting information. -
getWeekNumbersWillOverrideFirstDayOfWeek
public boolean getWeekNumbersWillOverrideFirstDayOfWeek()getWeekNumbersWillOverrideFirstDayOfWeek, Returns the value of this setting. See the "set" function for setting information. -
hasParent
public boolean hasParent()hasParent, This returns true if this settings instance has a parent, otherwise returns false. A settings instance will have a parent if the settings instance has already been used to construct a DatePicker, or to construct an independent CalendarPanel. Note that settings instances cannot be reused. They are only expected to ever have one parent. -
isDateAllowed
isDateAllowed, This checks to see if the specified date is allowed by any currently set veto policy, and allowed by the current setting of allowEmptyDates. If allowEmptyDates is false, and the specified date is null, then this returns false. If a veto policy exists, and the specified date is vetoed, then this returns false. If the date is not vetoed, or if empty dates are allowed and the date is null, then this returns true. -
setAllowEmptyDates
public void setAllowEmptyDates(boolean allowEmptyDates) setAllowEmptyDates, This sets whether or not empty dates (null dates) are allowed in the DatePicker or independent CalendarPanel. If this is true, then empty dates will be allowed. If this is false, then empty dates will not be allowed. If setting this function to false, it is recommended to call this function -before- setting a veto policy. This sequence will guarantee that the DatePicker.getDate() (or CalendarPanel.getSelectedDate()) functions will never return a null value, and will guarantee that the setAllowEmptyDates() function will not throw an exception. If the current date is null and you set allowEmptyDates to false, then this function will attempt to initialize the current date to today's date. This function will throw an exception if it fails to initialize a null date. An exception is only possible if a veto policy is set before calling this function, and the veto policy vetoes today's date. -
setAllowKeyboardEditing
public void setAllowKeyboardEditing(boolean allowKeyboardEditing) setAllowKeyboardEditing, This sets whether or not keyboard editing is allowed for this date picker. If this is true, then dates can be entered into the date picker either by using the keyboard or the mouse. If this is false, then dates can only be selected by using the mouse. The default value is true. It is generally recommended to leave this setting as "true". Accessibility Impact: Disallowing the use of the keyboard, and requiring the use of the mouse, could impact the accessibility of your program for disabled persons. Note: This setting does not impact the automatic enforcement of valid or vetoed dates. To learn about the automatic date validation and enforcement for keyboard entered text, see the javadocs for the DatePicker class. -
setBorderCalendarPopup
setBorderCalendarPopup, This sets the border for the calendar popup window. If this is null, a default border will be provided by the CustomPopup class. The default value is null. This function only applies if the parent of the settings is a DatePicker. (Not if the parent is an independent CalendarPanel.) -
setBorderPropertiesList
setBorderPropertiesList, This sets the list of border properties objects that specifies the colors and thicknesses of the borders in the CalendarPanel. By default, a default set of border properties is stored in the borderPropertiesList. Passing in "null" when setting this property will restore the default border properties. If you don't want the default border properties but wish to truly "clear" the border properties list, you could pass in an empty ArrayList. To modify the calendar borders (including individual border colors, thickness, or visibility), you can supply your own ArrayList of border properties. Border properties objects are applied in the order that they appear in the ArrayList. To learn how to set the CalendarBorderProperties objects, see the CalendarBorderProperties class javadocs. The default border properties have a one pixel blue border around the date labels, and two vertical light blue borders near the weekday labels (which match the color of the weekday labels). The outer top horizontal border and the outer left vertical border are invisible by default. The default border properties also include borders above and below the "week numbers" column which match the color of the week numbers labels. (However, these borders are only displayed when the week numbers are displayed.) Whenever the border properties list is applied, the borders are first "cleared" by setting all borders to the following settings: Invisible, and black color. This is true of both the default border properties and any programmer supplied border properties. Note: If weekNumbersDisplayed is set to false, then the borders located in the week number columns (Columns 1 and 2) will always be hidden. -
setClock
setClock, This sets the clock to use for determining the current date. By default the system clock is used.- Parameters:
clock
- A clock to use
-
setColor
setColor, This sets a color for the specified area. Setting an area to null will restore the default color for that area. -
setColorBackgroundWeekNumberLabels
public void setColorBackgroundWeekNumberLabels(Color colorBackgroundWeekNumberLabels, boolean applyMatchingDefaultBorders) setColorBackgroundWeekNumberLabels, This sets the calendar background color for the week number labels. The default color is a medium sky blue.- Parameters:
applyMatchingDefaultBorders
- This determines if this function will update the border label properties to show the appropriate default borders. The default border label settings are different, depending on the "colorBackgroundWeekNumberLabels". If you have not customized the border label properties, then it is recommended that you always set the "applyMatchingDefaultBorders" parameter to true. This will ensure that the calendar borders will always use the correct default settings. If you set this parameter to false, than the current border settings will not be changed by this function.
-
setColorBackgroundWeekdayLabels
public void setColorBackgroundWeekdayLabels(Color colorBackgroundWeekdayLabels, boolean applyMatchingDefaultBorders) setColorBackgroundWeekdayLabels, This sets the calendar background color for the weekday labels. The default color is a medium sky blue.- Parameters:
applyMatchingDefaultBorders
- This determines if this function will update the border label properties to show the appropriate default borders. The default border label settings are different, depending on the "colorBackgroundWeekdayLabels". If you have not customized the border label properties, then it is recommended that you always set the "applyMatchingDefaultBorders" parameter to true. This will ensure that the calendar borders will always use the correct default settings. If you set this parameter to false, than the current border settings will not be changed by this function.
-
setDateRangeLimits
setDateRangeLimits, This is a convenience function, for setting a DateVetoPolicy that will limit the allowed dates in the parent object to a specified minimum and maximum date value. Calling this function will always replace any existing DateVetoPolicy. If you only want to limit one side of the date range, then you can pass in "null" for the other date variable. If you pass in null for both values, then the current veto policy will be cleared. Important Note: The DatePicker or independent CalendarPanel associated with this settings instance is known as the "parent component". This function can only be called after the parent component is constructed with this settings instance. If this is called before the parent is constructed, then an exception will be thrown. For more details, see: "DatePickerSettings.setVetoPolicy()". Return value: It's possible to set a veto policy that vetoes the currently selected date. This function returns true if the selected date is allowed by the new veto policy and the other current settings, or false if the selected date is vetoed or disallowed. Setting a new veto policy does not modify the selected date. Is up to the programmer to resolve any potential conflict between a new veto policy, and the currently selected date. -
setDefaultYearMonth
setDefaultYearMonth, This sets which YearMonth should be displayed by default, when no date is currently selected. This is used only when a when a calendar panel (or calendar popup) is displayed or showing. If this is set to null, then the defaultYearMonth will be YearMonth.now(). -
setEnableMonthMenu
public void setEnableMonthMenu(boolean enableMonthMenu) setEnableMonthMenu, This sets the month popup menu to be enabled or disabled. (Note: The month label is located in the header area of the calendar panel.) If this is true, then the month label will give a visual indication of any "mouse over" events, and the month menu will open when the month label is clicked. If this is false, then the month label will not indicate mouse over events, and the month menu can not be opened. The default value for this setting is true. Note: It is generally recommended to leave the month menu enabled. Disabling this menu can negatively impact calendar usability. When the month menu is disabled, the user may have to press the month navigation button many times to reach a desired month. -
setEnableYearMenu
public void setEnableYearMenu(boolean enableYearMenu) setEnableYearMenu, This sets the year popup menu to be enabled or disabled. (Note: The year label is located in the header area of the calendar panel.) If this is true, then the year label will give a visual indication of any "mouse over" events, and the year menu will open when the year label is clicked. If this is false, then the year label will not indicate mouse over events, and the year menu can not be opened. The default value for this setting is true. Note: It is generally recommended to leave the year menu enabled. Disabling this menu can negatively impact calendar usability. When the year menu is disabled, it may become difficult or effectively impossible for the user to navigate to years that are far into the past or the future. -
setFirstDayOfWeek
setFirstDayOfWeek, This sets the day of the week that will be displayed in the far left column of the CalendarPanel, as the "first day of the week". The default value is generated using the locale of the settings instance. By default, If weekNumbersDisplayed is set to true, then the first day of the week will not match the setting. (weekNumbersDisplayed is false by default.) For additional details, see the javadocs for the following settings: "weekNumbersDisplayed", and "weekNumbersForceFirstDayOfWeekToMatch". -
setFontCalendarDateLabels
setFontCalendarDateLabels, This sets the font for the date numbers in the calendar panel. (Technical note: The date numbers are in JLabel instances.) -
setFontCalendarWeekNumberLabels
setFontCalendarWeekNumberLabels, This sets the font for the week numbers in the calendar panel. (This color will only appear if the week numbers are enabled.) -
setFontCalendarWeekdayLabels
setFontCalendarWeekdayLabels, This sets the font for the weekday labels in the calendar panel. -
setFontClearLabel
setFontClearLabel, This sets the font for the clear label, (this also acts as a "button"), in the calendar panel. -
setFontInvalidDate
setFontInvalidDate, This sets the text field text font for invalid dates. The default font is a normal undecorated font. (Note: The color for invalid dates defaults to Color.red. See also: "colorTextInvalidDate".) -
setFontMonthAndYearMenuLabels
setFontMonthAndYearMenuLabels, This sets the font for the (two) month and year menu labels (these also act as "buttons") in the calendar panel. -
setFontTodayLabel
setFontTodayLabel, This sets the font for the today label, (this also acts as a "button"), in the calendar panel. -
setFontValidDate
setFontValidDate, This sets the text field text font for valid dates. The default font is a normal undecorated font, as provided by JTextField. Note: Changing the font for valid dates may also change the default minimum size for the date picker. This will not affect the minimum size if it has been overridden by the programmer. -
setFontVetoedDate
setFontVetoedDate, This sets the text field text font for vetoed dates. The default font crosses out the vetoed date. (Has a strikethrough font attribute.) -
setFormatForDatesBeforeCommonEra
setFormatForDatesBeforeCommonEra, This sets the format that is used to display or parse BCE dates in the date picker, from a DateTimeFormatter instance. The default value for the date format is generated using the locale of the settings instance. For most desired date formats, it would probably be easier to use the other "pattern string" version of this function. (which accepts a date pattern string instead of a DateTimeFormatter instance.) Note: It is important to use the letter "u" (astronomical year) instead of "y" (year of era) when creating pattern strings for BCE dates. This is because the DatePicker uses ISO 8601, which specifies "Astronomical year numbering". (Additional details: The astronomical year "-1" and "1 BC" are not the same thing. Astronomical years are zero-based, and BC dates are one-based. Astronomical year "0", is the same year as "1 BC", and astronomical year "-1" is the same year as "2 BC", and so forth.) The various codes for the date pattern string are described at this link: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html If the date picker has already been constructed, then calling this function will cause immediate validation of the text field text. -
setFormatForDatesBeforeCommonEra
setFormatForDatesBeforeCommonEra, This sets the format that is used to display or parse BCE dates in the date picker, from a DateTimeFormatter pattern string. The default value for the date format is generated using the locale of the settings instance. Note: It is important to use the letter "u" (astronomical year) instead of "y" (year of era) when creating pattern strings for BCE dates. This is because the DatePicker uses ISO 8601, which specifies "Astronomical year numbering". (Additional details: The astronomical year "-1" and "1 BC" are not the same thing. Astronomical years are zero-based, and BC dates are one-based. Astronomical year "0", is the same year as "1 BC", and astronomical year "-1" is the same year as "2 BC", and so forth.) The various codes for the date pattern string are described at this link: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html If the date picker has already been constructed, then calling this function will cause immediate validation of the text field text. -
setFormatForDatesCommonEra
setFormatForDatesCommonEra, This sets the format that is used to display or parse CE dates in the date picker, from a DateTimeFormatter instance. The default value for the date format is generated using the locale of the settings instance. For most desired date formats, it would probably be easier to use the other "pattern string" version of this function. (which accepts a date pattern string instead of a DateTimeFormatter instance.) The various codes for the date pattern string are described at this link: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html If the date picker has already been constructed, then calling this function will cause immediate validation of the text field text. Note: Changing the format for CE dates may also change the default minimum width of the date picker text field. -
setFormatForDatesCommonEra
setFormatForDatesCommonEra, This sets the format that is used to display or parse CE dates in the date picker, from a DateTimeFormatter pattern string. The default value for the date format is generated using the locale of the settings instance. The various codes for the date pattern string are described at this link: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html If the date picker has already been constructed, then calling this function will cause immediate validation of the text field text. Note: Changing the format for CE dates may also change the default minimum width of the date picker text field. -
setFormatForTodayButton
setFormatForTodayButton, This sets the format that is used to format today's date into a date string, which is displayed on the today button. The default value is generated using the locale of the settings instance. -
setFormatsForParsing
setFormatsForParsing, This holds a list of formats that are used to attempt to parse dates that are typed by the user. When parsing a date, these formats are tried in the order that they appear in this list. Note that the formatForDatesCommonEra and formatForDatesBeforeCommonEra are always tried (in that order) before any other parsing formats. The default values for the formatsForParsing are generated using the pickerLocale, using the enum constants in java.time.format.FormatStyle. -
setGapBeforeButtonPixels
setGapBeforeButtonPixels, This specifies the desired width for the gap between the date picker and the toggle calendar button (in pixels). The default value is null. If this is left at null, then the default value is 3 pixels. -
setHighlightPolicy
setHighlightPolicy, This sets a highlight policy for the parent DatePicker or parent independent CalendarPanel. If a highlight policy is supplied, it will be used to determine which dates should be highlighted in the calendar panel. The highlight policy can also supply tooltip text for any highlighted dates. See the demo class for an example of constructing a highlight policy. By default, there is no highlight policy. (The default value is null.) -
setLocale
setLocale, This will set the locale for this DatePickerSettings instance, and will set all other settings that depend on the locale to their default values. Warning: Every setting whose default value depends on the locale, will be overwritten whenever this function is called. This is a list of all the settings which are overwritten by this function: locale, translationArrayStandaloneLongMonthNames, translationArrayStandaloneShortMonthNames, translationToday, translationClear, formatForTodayButton, formatForDatesCommonEra, formatForDatesBeforeCommonEra, formatsForParsing, firstDayOfWeek, weekNumberRules. For most applications, it is generally recommended to only set the locale from the DatePickerSettings constructor. If you use setLocale() to change the locale after construction, then you will overwrite any previously customized locale-specific settings. Passing in "null" will apply the default locale for the current Java Virtual Machine. -
setSizeDatePanelMinimumHeight
public void setSizeDatePanelMinimumHeight(int sizeDatePanelMinimumHeight) setSizeDatePanelMinimumHeight, This sets the minimum height, in pixels, of the date label area. The date label area is the part of the calendar panel that holds (only) the date labels. The remainder of the calendar panel is automatically resized to encompass the date label area. The default value for this variable is (6 * 18). If the default value is modified, the programmer may also wish to adjust sizeDatePanelPixelsExtraHeight. -
setSizeDatePanelMinimumWidth
public void setSizeDatePanelMinimumWidth(int sizeDatePanelMinimumWidth) setSizeDatePanelMinimumWidth, This sets the minimum width, in pixels, of the date label area. The date label area is the part of the calendar panel that holds (only) the date labels. The remainder of the calendar panel is automatically resized to encompass the date label area. The default value for this variable is (7 * 30). If the default value is modified, the programmer may also wish to adjust sizeDatePanelPixelsExtraWidth. -
setSizeTextFieldMinimumWidth
setSizeTextFieldMinimumWidth, This sets the minimum width in pixels, of the DatePicker text field. (The text field is located to the left of the date picker "popup calendar" button, and displays the currently selected date.) The default value for this setting is null. When this is set to null, a default width for the date picker text field will be automatically calculated and applied to fit "the largest possible date" (with a four digit year) that can be displayed with the current date picker settings. The settings used to calculate the default text field width include the locale (the language), the fontValidDate, and the formatForDatesCommonEra. -
setSizeTextFieldMinimumWidthDefaultOverride
public void setSizeTextFieldMinimumWidthDefaultOverride(boolean defaultShouldOverrideIfNeeded) setSizeTextFieldMinimumWidthDefaultOverride, This specifies how the date picker should choose the appropriate minimum width for the date picker text field. (As described below.) If this is true, then the applied minimum width will be the largest of either the default, or any programmer supplied, minimum widths. If this is false, then any programmer supplied minimum width will always override the default minimum width. (Even if the programmer supplied width is too small to fit the dates that can be displayed in the DatePicker). The default value for this setting is true. This setting only has an effect if (sizeTextFieldMinimumWidth != null). See also: "setSizeTextFieldMinimumWidth()". -
setTranslationArrayStandaloneLongMonthNames
setTranslationArrayStandaloneLongMonthNames, This sets an array of month names to use for the calendar panel header, as translated to the current language. It is not expected that this variable will need to be changed by the programmer. The default values are generated using the locale of the settings instance, by retrieving the translated text for the current language from the class called java.text.DateFormatSymbols. This array is indexed with January = 0. The Calendar class month name constants can also be used for indexing. (Calendar.JANUARY, etc). Setting this to null will restore the default values. Expected array contents: The array should always have a length of 12. Each element should always contain a string that is not null and not empty. -
setTranslationArrayStandaloneShortMonthNames
setTranslationArrayStandaloneShortMonthNames, This sets an array of short month names to use for the calendar panel header, as translated to the current language. It is not expected that this variable will need to be changed by the programmer. The default values are generated using the locale of the settings instance, by retrieving the translated text for the current language from the class called java.text.DateFormatSymbols. This array is indexed with January = 0. The Calendar class month name constants can also be used for indexing. (Calendar.JANUARY, etc). Setting this to null will restore the default values. Expected array contents: The array should always have a length of 12. Each element should always contain a string that is not null and not empty. -
setTranslationClear
setTranslationClear, This sets the text of the calendars "Clear" button, as translated to the current language. It is not expected that this variable will need to be changed by the programmer. If you wish to supply a new translation for the date picker, it would generally be better to add (or edit) your translation in the "TranslationResources.properties" file. The default value is generated using the locale of the settings instance, by retrieving the translated text for the current language from the properties file. -
setTranslationToday
setTranslationToday, This sets the text of the calendars "Today" button, as translated to the current language. It is not expected that this variable will need to be changed by the programmer. If you wish to supply a new translation for the date picker, it would generally be better to add (or edit) your translation in the "TranslationResources.properties" file. The default value is generated from the locale of the settings instance, by retrieving the translated text for the current language from the properties file. -
setVetoPolicy
setVetoPolicy, This sets a veto policy for the parent DatePicker or parent independent CalendarPanel. Important Note: The DatePicker or independent CalendarPanel associated with this settings instance is known as the "parent component". This function can only be called after the parent component is constructed with this settings instance. If this is called before the parent is constructed, then an exception will be thrown. When a veto policy is supplied, it will be used to determine which dates can or can not be selected in the calendar panel. (Vetoed dates are also not accepted into the date picker text field). See the demo class for an example of constructing a veto policy. By default, there is no veto policy. Setting this function to null will clear any veto policy that has been set. Return value: It's possible to set a veto policy that vetoes the currently selected date. This function returns true if the selected date is allowed by the new veto policy and the other current settings, or false if the selected date is vetoed or disallowed. Setting a new veto policy does not modify the selected date. Is up to the programmer to resolve any potential conflict between a new veto policy, and the currently selected date. -
setVisibleDateTextField
public void setVisibleDateTextField(boolean isVisible) setVisibleDateTextField, This sets the visibility of the DatePicker text field. This can be used in conjunction with "setGapBeforeButtonPixels(0)" to create an instance of the date picker that only displays the toggle calendar button. One reason a developer might want to do this, is if they wished to provide their own component to display any selected date. -
setVisibleClearButton
public void setVisibleClearButton(boolean isVisible) setVisibleClearButton, This sets the visibility of the named component. -
setVisibleMonthMenuButton
public void setVisibleMonthMenuButton(boolean isVisible) setVisibleMonthMenuButton, This sets the visibility of the named component. -
setVisibleNextMonthButton
public void setVisibleNextMonthButton(boolean isVisible) setVisibleNextMonthButton, This sets the visibility of the named component. -
setVisibleNextYearButton
public void setVisibleNextYearButton(boolean isVisible) setVisibleNextYearButton, This sets the visibility of the named component. -
setVisiblePreviousMonthButton
public void setVisiblePreviousMonthButton(boolean isVisible) setVisiblePreviousMonthButton, This sets the visibility of the named component. -
setVisiblePreviousYearButton
public void setVisiblePreviousYearButton(boolean isVisible) setVisiblePreviousYearButton, This sets the visibility of the named component. -
setVisibleTodayButton
public void setVisibleTodayButton(boolean isVisible) setVisibleTodayButton, This sets the visibility of the named component. -
setVisibleYearMenuButton
public void setVisibleYearMenuButton(boolean isVisible) setVisibleYearMenuButton, This sets the visibility of the named component. -
setWeekNumberRules
setWeekNumberRules, This sets the week number rules that will be used to show the week numbers (the weeks of the year), whenever the week numbers are displayed on this calendar. The definitions for the first day of the week, and for the minimum number of days that constitutes the first week of the year, varies between locales. The Java time WeekFields class specifies those rules. If you set this setting to null, then the weekNumberRules will be set to match the DatePickerSettings locale. By default, the week number rules will match the DatePickerSettings locale. If you would like the week number rules to be the same for all calendars (regardless of the locale), then you should consider setting the weekNumberRules to one of these two widely used rule sets: WeekFields.ISO or WeekFields.SUNDAY_START. -
setWeekNumbersDisplayed
public void setWeekNumbersDisplayed(boolean weekNumbersDisplayed, boolean applyMatchingDefaultBorders) setWeekNumbersDisplayed, This specifies whether or not numbers for the "week of the year" should be displayed on the calendar panel. The week numbers will be shown if this is true, or they will not be shown if this is false. This is false by default. The week numbers are locale sensitive, because the definition of the first day of the week, and the definition for the minimum number of days in the first week of the year, varies between locales. By default, when "weekNumbersDisplayed" is true, the first day of the week used by the calendar will always match the weekNumberRules definition for first day of the week. This behavior can be changed by modifying the setting "weekNumbersForceFirstDayOfWeekToMatch".- Parameters:
weekNumbersDisplayed
- This determines whether the week numbers should be displayed on the calendar. They will be shown if this is true, or not shown that this is falseapplyMatchingDefaultBorders
- This determines if this function will update the border label properties to show the appropriate default borders. The default border label settings are different, depending on "showWeekNumbers". If you have not customized the border label properties, then it is recommended that you always set the "applyMatchingDefaultBorders" parameter to true. This will ensure that the calendar borders will always use the correct default settings. If you set this parameter to false, than the current border settings will not be changed by this function.
-
setWeekNumbersWillOverrideFirstDayOfWeek
public void setWeekNumbersWillOverrideFirstDayOfWeek(boolean weekNumbersWillOverrideFirstDayOfWeek) setWeekNumbersWillOverrideFirstDayOfWeek, This setting determines how to resolve any conflict between the "weekNumberRules" setting and the "firstDayOfWeek" setting. Note: This setting only has an effect when "weekNumbersDisplayed" is true. 1) If this setting is true (Default): Whenever the week numbers are displayed, then the first day of the week that is displayed on the calendar will always match the currently set "weekNumberRules". This enforces a strict and consistent definition for the week numbers. Specifically, this guarantees that all seven dates in each calendar row will belong to a single week number. Note: The WeekNumberRules are an instance of the java.time.temporal "WeekFields" class. For more information about how week numbers are defined, see the WeekFields javadocs. 2) If this setting is false: The first day of the week that is displayed on the calendar will always match the "firstDayOfWeek" setting, and a more "flexible" definition of week numbers will be applied. Using a firstDayOfWeek that does not match the week number rules will cause each calendar row to contain dates that fall inside two different week numbers. (As defined by the weekNumberRules.) In this circumstance, the displayed week numbers will be determined by a "majority rules" system, which is defined below. The "majority rules" system: Under the majority rule system, the calendar will count the number of days in each row that belong to each week number. In a single row, four (or more) days will match one week number, and three (or less) days will match a different week number. The most commonly occurring week number will be displayed next to each row. To summarize: If your program needs to implement a strict week number definition, then it is recommended to leave this setting at its default value (of true). If it is more important to have a flexible first day of the week, then you could set this value to false. When this setting is false, the displayed week numbers will follow a "majority rules" system, and will not exactly match the week number rules.
-