|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
org.jdesktop.swingx.JXMonthView
public class JXMonthView
Component that displays a month calendar which can be used to select a day
or range of days. By default the JXMonthView
will display a
single calendar using the current month and year, using
Calendar.SUNDAY
as the first day of the week.
The JXMonthView
can be configured to display more than one
calendar at a time by calling
setPreferredCalCols
/setPreferredCalRows
. These
methods will set the preferred number of calendars to use in each
column/row. As these values change, the Dimension
returned
from getMinimumSize
and getPreferredSize
will
be updated. The following example shows how to create a 2x2 view which is
contained within a JFrame
:
JXMonthView monthView = new JXMonthView(); monthView.setPreferredCols(2); monthView.setPreferredRows(2); JFrame frame = new JFrame(); frame.getContentPane().add(monthView); frame.pack(); frame.setVisible(true);
JXMonthView
can be further configured to allow any day of the
week to be considered the first day of the week. Character
representation of those days may also be set by providing an array of
strings.
monthView.setFirstDayOfWeek(Calendar.MONDAY); monthView.setDaysOfTheWeek( new String[]{"S", "M", "T", "W", "Th", "F", "S"});
This component supports flagging days. These flagged days are displayed in a bold font. This can be used to inform the user of such things as scheduled appointment.
// Create some dates that we want to flag as being important.
Calendar cal1 = Calendar.getInstance();
cal1.set(2004, 1, 1);
Calendar cal2 = Calendar.getInstance();
cal2.set(2004, 1, 5);
monthView.setFlaggedDates(cal1.getTime(), cal2.getTime(), new Date());
Applications may have the need to allow users to select different ranges of
dates. There are three modes of selection that are supported, single, single interval
and multiple interval selection. Once a selection is made a DateSelectionEvent is
fired to inform listeners of the change.
// Change the selection mode to select full weeks. monthView.setSelectionMode(SelectionMode.SINGLE_INTERVAL_SELECTION); // Register a date selection listener to get notified about // any changes in the date selection model. monthView.getSelectionModel().addDateSelectionListener(new DateSelectionListener { public void valueChanged(DateSelectionEvent e) { log.info(e.getSelection()); } });NOTE (for users of earlier versions): as of version 1.19 control about selection dates is moved completely into the model. The default model used is of type DaySelectionModel, which handles dates in the same way the JXMonthView did earlier (that is, normalize all to the start of the day, which means zeroing all time fields).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected Insets |
_monthStringInsets
|
static String |
BOX_PADDING_X
|
static String |
BOX_PADDING_Y
|
static String |
CANCEL_KEY
action command used for cancel actionEvent. |
static String |
COMMIT_KEY
action command used for commit actionEvent. |
static int |
DAYS_IN_WEEK
|
static String |
DAYS_OF_THE_WEEK
|
static String |
FLAGGED_DATES
|
protected Date |
modifiedEndDate
|
protected Date |
modifiedStartDate
|
static int |
MONTHS_IN_YEAR
|
static String |
SELECTION_MODEL
|
static String |
TRAVERSABLE
|
static String |
uiClassID
UI Class ID |
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 | |
---|---|
JXMonthView()
Create a new instance of the JXMonthView class using the
default Locale and the current system time as the first date to
display. |
|
JXMonthView(Date firstDisplayedDate)
Create a new instance of the JXMonthView class using the
default Locale and the given time as the first date to
display. |
|
JXMonthView(Date firstDisplayedDate,
DateSelectionModel model)
Create a new instance of the JXMonthView class using the
default Locale, the given time as the first date to
display and the given selection model. |
|
JXMonthView(Date firstDisplayedDay,
DateSelectionModel model,
Locale locale)
Create a new instance of the JXMonthView class using the
given Locale, the given time as the first date to
display and the given selection model. |
|
JXMonthView(Locale locale)
Create a new instance of the JXMonthView class using the
default Locale and the current system time as the first date to
display. |
Method Summary | ||
---|---|---|
void |
addActionListener(ActionListener l)
Adds an ActionListener. |
|
void |
addFlaggedDates(Date... flagged)
Adds the dates to the flags. |
|
void |
addNotify()
Notifies this component that it now has a parent component. |
|
void |
addSelectionInterval(Date startDate,
Date endDate)
Adds the selection interval to the selection model. |
|
void |
cancelSelection()
Cancels the selection. |
|
protected void |
cleanupWeekSelectionDates(Date startDate,
Date endDate)
Deprecated. pre-0.9.5 - this is kept as a reminder only, don't use! we can make this private or comment it out after next version |
|
void |
clearFlaggedDates()
Clears all flagged dates. |
|
void |
clearSelection()
Clear any selection from the selection model |
|
void |
commitSelection()
Commits the current selection. |
|
void |
ensureDateVisible(Date date)
Moves the date into the visible region of the calendar. |
|
protected void |
fireActionPerformed(String actionCommand)
Creates and fires an ActionEvent with the given action command to all listeners. |
|
protected Date |
getAnchorDate()
Returns the anchor date. |
|
int |
getBoxPaddingX()
Returns the padding used between days in the calendar. |
|
int |
getBoxPaddingY()
Returns the padding used above and below days in the calendar. |
|
Calendar |
getCalendar()
Returns a clone of the internal calendar, with it's time set to firstDisplayedDate. |
|
Date |
getDayAtLocation(int x,
int y)
Returns the Date at the given location. |
|
Color |
getDayForeground(int dayOfWeek)
Return the color that should be used for painting the numerical day of the week. |
|
String |
getDayOfTheWeek(int dayOfWeek)
|
|
String[] |
getDaysOfTheWeek()
Returns the String representation for each day of the week. |
|
Color |
getDaysOfTheWeekForeground()
|
|
int |
getFirstDayOfWeek()
Gets what the first day of the week is; e.g., Calendar.SUNDAY in the U.S., Calendar.MONDAY
in France. |
|
Date |
getFirstDisplayedDay()
Returns the first displayed date. |
|
Date |
getFirstSelectionDate()
Returns the earliest selected date. |
|
SortedSet<Date> |
getFlaggedDates()
Returns a sorted set of flagged Dates. |
|
Color |
getFlaggedDayForeground()
Return the color that should be used for painting the foreground of the flagged day. |
|
Date |
getLastDisplayedDay()
Returns the last date able to be displayed. |
|
Date |
getLastSelectionDate()
Returns the earliest selected date. |
|
|
getListeners(Class<T> listenerType)
Returns an array of all the objects currently registered as FooListener s
upon this JComponent . |
|
Date |
getLowerBound()
Return the lower bound date that is allowed to be selected for this model. |
|
Color |
getMonthStringBackground()
Returns the color used to paint the month string background. |
|
Color |
getMonthStringForeground()
Returns the color used to paint the month string foreground. |
|
Insets |
getMonthStringInsets()
Returns a copy of the insets used to paint the month string background. |
|
Color |
getPerDayOfWeekForeground(int dayOfWeek)
Return the color that should be used for painting the numerical day of the week. |
|
int |
getPreferredColumnCount()
Returns the preferred number of columns to paint calendars in. |
|
int |
getPreferredRowCount()
Returns the preferred number of rows to paint calendars in. |
|
SortedSet<Date> |
getSelection()
Get the current selection |
|
Color |
getSelectionBackground()
Returns the selected background color. |
|
Date |
getSelectionDate()
Returns the earliest selected date. |
|
Color |
getSelectionForeground()
Returns the selected foreground color. |
|
DateSelectionModel.SelectionMode |
getSelectionMode()
Returns the current selection mode for this JXMonthView. |
|
DateSelectionModel |
getSelectionModel()
Returns the date selection model which drives this JXMonthView. |
|
TimeZone |
getTimeZone()
Gets the time zone. |
|
Date |
getToday()
Returns the start of today in this monthviews calendar coordinates. |
|
Color |
getTodayBackground()
Returns the color used when painting the today background. |
|
MonthViewUI |
getUI()
|
|
String |
getUIClassID()
Returns the UIDefaults key used to
look up the name of the swing.plaf.ComponentUI
class that defines the look and feel
for this component. |
|
Date |
getUpperBound()
Return the upper bound date that is allowed to be selected for this model. |
|
boolean |
hasFlaggedDates()
Returns a boolean indicating if this monthView has flagged dates. |
|
protected void |
incrementToday()
Increments today. |
|
boolean |
isComponentInputMapEnabled()
Returns the componentInputMapEnabled property. |
|
boolean |
isFlaggedDate(Date date)
Identifies whether or not the date passed is a flagged date. |
|
boolean |
isSelected(Date date)
Returns true if the specified date falls within the _startSelectedDate and _endSelectedDate range. |
|
boolean |
isSelectionEmpty()
Return true if the selection is empty, false otherwise |
|
boolean |
isShowingLeadingDays()
Returns a boolean indicating whether or not we're showing leading dates. |
|
boolean |
isShowingTrailingDays()
Returns a boolean indicating whether or not we're showing trailing dates. |
|
boolean |
isShowingWeekNumber()
Returns whether or not this JXMonthView should display
week number. |
|
boolean |
isTraversable()
Returns whether or not the month view supports traversing months. |
|
boolean |
isUnselectableDate(Date date)
Identifies whether or not the date passed is an unselectable date. |
|
boolean |
isZoomable()
Returns true if zoomable (through date ranges). |
|
void |
removeActionListener(ActionListener l)
Removes an ActionListener. |
|
void |
removeFlaggedDates(Date... flagged)
Unflags the given dates. |
|
void |
removeNotify()
Notifies this component that it no longer has a parent component. |
|
void |
removeSelectionInterval(Date startDate,
Date endDate)
Removes the selection interval from the selection model. |
|
void |
setBoxPaddingX(int boxPaddingX)
Sets the number of pixels used to pad the left and right side of a day. |
|
void |
setBoxPaddingY(int boxPaddingY)
Sets the number of pixels used to pad the top and bottom of a day. |
|
void |
setComponentInputMapEnabled(boolean enabled)
Sets the component input map enablement property. |
|
void |
setDayForeground(int dayOfWeek,
Color c)
Set the color to be used for painting the specified day of the week. |
|
void |
setDaysOfTheWeek(String[] days)
Sets the String representation for each day of the week as used in the header of the day's grid. |
|
void |
setDaysOfTheWeekForeground(Color c)
Sets the color used to draw the foreground of each day of the week. |
|
void |
setFirstDayOfWeek(int firstDayOfWeek)
Sets what the first day of the week is; e.g., Calendar.SUNDAY in US, Calendar.MONDAY
in France. |
|
void |
setFirstDisplayedDay(Date date)
Set the first displayed date. |
|
void |
setFlaggedDates(Date... flagged)
Replace all flags with the given dates. |
|
void |
setFlaggedDayForeground(Color c)
Set the color to be used for painting the foreground of a flagged day. |
|
void |
setLocale(Locale locale)
Sets locale and resets text and format used to display months and days. |
|
void |
setLowerBound(Date lowerBound)
Set the lower bound date that is allowed to be selected. |
|
void |
setMonthStringBackground(Color c)
Sets the color used to draw the background of the month string. |
|
void |
setMonthStringForeground(Color c)
Sets the color used to draw the foreground of the month string. |
|
void |
setMonthStringInsets(Insets insets)
Insets used to modify the width/height when painting the background of the month string area. |
|
void |
setPreferredColumnCount(int cols)
Sets the preferred number of columns of calendars. |
|
void |
setPreferredRowCount(int rows)
Sets the preferred number of rows to paint calendars.Does nothing if rows <= 0. |
|
void |
setSelectionBackground(Color c)
Sets the selected background color to c . |
|
void |
setSelectionDate(Date newDate)
Sets the model's selection to the given date or clears the selection if null. |
|
void |
setSelectionForeground(Color c)
Sets the selected foreground color to c . |
|
void |
setSelectionInterval(Date startDate,
Date endDate)
Sets the selection interval to the selection model. |
|
void |
setSelectionMode(DateSelectionModel.SelectionMode selectionMode)
Set the selection mode for this JXMonthView. |
|
void |
setSelectionModel(DateSelectionModel model)
Sets the date selection model to drive this monthView. |
|
void |
setShowingLeadingDays(boolean value)
Sets a boolean property indicating whether or not to show leading dates for a months displayed by this component. |
|
void |
setShowingTrailingDays(boolean value)
Sets a boolean property indicating whether or not to show trailing dates for the months displayed by this component. |
|
void |
setShowingWeekNumber(boolean showWeekNumber)
Set whether or not this JXMonthView will display week
numbers or not. |
|
void |
setTimeZone(TimeZone tz)
Sets the time zone with the given time zone value. |
|
protected void |
setToday(Date date)
Sets the date which represents today. |
|
void |
setTodayBackground(Color c)
Sets the color used to draw the bounding box around today. |
|
void |
setTraversable(boolean traversable)
Set whether or not the month view will display buttons to allow the user to traverse to previous or next months. |
|
void |
setUI(MonthViewUI ui)
Sets the L&F object that renders this component. |
|
void |
setUnselectableDates(Date... unselectableDates)
Sets the dates that should be unselectable. |
|
void |
setUpperBound(Date upperBound)
Set the upper bound date that is allowed to be selected. |
|
void |
setZoomable(boolean zoomable)
Sets the zoomable property. |
|
protected void |
updateDatesAfterTimeZoneChange(TimeZone oldTimeZone)
All dates are "cleaned" relative to the timezone they had been set. |
|
protected void |
updateTodayFromCurrentTime()
Sets today from the current system time. |
|
void |
updateUI()
Resets the UI property with the value from the current look and feel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String COMMIT_KEY
public static final String CANCEL_KEY
public static final String BOX_PADDING_X
public static final String BOX_PADDING_Y
public static final String DAYS_OF_THE_WEEK
public static final String SELECTION_MODEL
public static final String TRAVERSABLE
public static final String FLAGGED_DATES
public static final String uiClassID
public static final int DAYS_IN_WEEK
public static final int MONTHS_IN_YEAR
protected Date modifiedStartDate
protected Date modifiedEndDate
protected Insets _monthStringInsets
Constructor Detail |
---|
public JXMonthView()
JXMonthView
class using the
default Locale and the current system time as the first date to
display.
public JXMonthView(Locale locale)
JXMonthView
class using the
default Locale and the current system time as the first date to
display.
locale
- desired locale, if null the system default locale is usedpublic JXMonthView(Date firstDisplayedDate)
JXMonthView
class using the
default Locale and the given time as the first date to
display.
firstDisplayedDate
- The first month to display.public JXMonthView(Date firstDisplayedDate, DateSelectionModel model)
JXMonthView
class using the
default Locale, the given time as the first date to
display and the given selection model.
firstDisplayedDate
- The first month to display.model
- the selection model to use, if null a DefaultSelectionModel
is
created.public JXMonthView(Date firstDisplayedDay, DateSelectionModel model, Locale locale)
JXMonthView
class using the
given Locale, the given time as the first date to
display and the given selection model.
firstDisplayedDay
- model
- the selection model to use, if null a DefaultSelectionModel
is
created.locale
- desired locale, if null the system default locale is usedMethod Detail |
---|
public void setLocale(Locale locale)
PENDING JW: the following warning should be obsolete (installCalendar should take care) - check if it really is!
Warning: Since this resets any string labels that are cached in UI
(month and day names) and firstDayofWeek, use setDaysOfTheWeek
and/or
setFirstDayOfWeek after (re)setting locale.
setLocale
in class Component
locale
- new Locale to be used for formattingsetDaysOfTheWeek(String[])
,
setFirstDayOfWeek(int)
public Calendar getCalendar()
IllegalStateException
- if called before instantitation is completedpublic TimeZone getTimeZone()
TimeZone
used by the JXMonthView
.public void setTimeZone(TimeZone tz)
tz
- The TimeZone
.public int getFirstDayOfWeek()
Calendar.SUNDAY
in the U.S., Calendar.MONDAY
in France.
public void setFirstDayOfWeek(int firstDayOfWeek)
Calendar.SUNDAY
in US, Calendar.MONDAY
in France.
firstDayOfWeek
- The first day of the week.Calendar
protected Date getAnchorDate()
protected void updateDatesAfterTimeZoneChange(TimeZone oldTimeZone)
oldTimeZone
- the timezone before the changepublic Date getLastDisplayedDay()
public Date getFirstDisplayedDay()
public void setFirstDisplayedDay(Date date)
Calendar.DAY_OF_MONTH
field is reset to
1 and all other fields, with exception of the year and month,
are reset to 0.
date
- The first displayed date.public void ensureDateVisible(Date date)
date
into the visible region of the calendar. If
the date is greater than the last visible date it will become the last
visible date. While if it is less than the first visible date it will
become the first visible date. NOTE: this is the recommended method to scroll to a particular date, the functionally equivalent method taking a long as parameter will most probably be deprecated.
date
- Date to make visible, must not be null.ensureDateVisible(Date)
public Date getDayAtLocation(int x, int y)
x
- the x position of the location in pixely
- the y position of the location in pixel
protected void updateTodayFromCurrentTime()
protected void incrementToday()
protected void setToday(Date date)
date
- the date which should be used as today.public Date getToday()
public MonthViewUI getUI()
public void setUI(MonthViewUI ui)
ui
- UI to use for this JXMonthView
public void updateUI()
updateUI
in class JComponent
UIManager.getUI(JComponent)
public String getUIClassID()
javax.swing.JComponent
UIDefaults
key used to
look up the name of the swing.plaf.ComponentUI
class that defines the look and feel
for this component. Most applications will never need to
call this method. Subclasses of JComponent
that support
pluggable look and feel should override this method to
return a UIDefaults
key that maps to the
ComponentUI
subclass that defines their look and feel.
getUIClassID
in class JComponent
UIDefaults
key for a
ComponentUI
subclassUIDefaults.getUI(javax.swing.JComponent)
public DateSelectionModel getSelectionModel()
public void setSelectionModel(DateSelectionModel model)
model
- the selection model to use, must not be null.
NullPointerException
- if model is nullpublic void clearSelection()
public boolean isSelectionEmpty()
public SortedSet<Date> getSelection()
public void addSelectionInterval(Date startDate, Date endDate)
startDate
- Start of date range to add to the selectionendDate
- End of date range to add to the selectionpublic void setSelectionInterval(Date startDate, Date endDate)
startDate
- Start of date range to set the selection toendDate
- End of date range to set the selection topublic void removeSelectionInterval(Date startDate, Date endDate)
startDate
- Start of the date range to remove from the selectionendDate
- End of the date range to remove from the selectionpublic DateSelectionModel.SelectionMode getSelectionMode()
public void setSelectionMode(DateSelectionModel.SelectionMode selectionMode)
selectionMode
- The selection mode to use for this JXMonthView
public Date getFirstSelectionDate()
public Date getLastSelectionDate()
public Date getSelectionDate()
public void setSelectionDate(Date newDate)
newDate
- the selection date to setpublic boolean isSelected(Date date)
date
- The date to check
public void setLowerBound(Date lowerBound)
lowerBound
- the lower bound, null means none.public void setUpperBound(Date upperBound)
upperBound
- the upper bound, null means none.public Date getLowerBound()
public Date getUpperBound()
public boolean isUnselectableDate(Date date)
date
- date which to test for unselectable status
public void setUnselectableDates(Date... unselectableDates)
NOTE: neither the given array nor any of its elements must be null.
unselectableDates
- zero or more not-null dates that should be
unselectable.
NullPointerException
- if either the array or any of the elements
are nullpublic boolean isFlaggedDate(Date date)
date
- date which to test for flagged status
public void setFlaggedDates(Date... flagged)
NOTE: neither the given array nor any of its elements should be null. Currently, a null array will be tolerated to ease migration. A null has the same effect as clearFlaggedDates.
flagged
- the dates to be flaggedpublic void addFlaggedDates(Date... flagged)
flagged
- the dates to be flaggedpublic void removeFlaggedDates(Date... flagged)
flagged
- the dates to be unflaggedpublic void clearFlaggedDates()
public SortedSet<Date> getFlaggedDates()
public boolean hasFlaggedDates()
public void setShowingLeadingDays(boolean value)
The default value is false.
value
- true if leading dates should be displayed, false otherwise.public boolean isShowingLeadingDays()
public void setShowingTrailingDays(boolean value)
The default value is false.
value
- true if trailing dates should be displayed, false otherwise.public boolean isShowingTrailingDays()
public boolean isTraversable()
true
if month traversing is enabled.setZoomable(boolean)
public void setTraversable(boolean traversable)
The default value is false.
PENDING JW: fire the "real" property or the compound with zoomable?
traversable
- set to true to enable month traversing, false
otherwise.isTraversable()
,
setZoomable(boolean)
public boolean isZoomable()
setZoomable(boolean)
public void setZoomable(boolean zoomable)
Note: The actual zoomable behaviour is not yet implemented.
zoomable
- a boolean indicating whether or not zooming date
ranges is enabled.setTraversable(boolean)
public boolean isShowingWeekNumber()
JXMonthView
should display
week number.
true
if week numbers should be displayedpublic void setShowingWeekNumber(boolean showWeekNumber)
JXMonthView
will display week
numbers or not.
showWeekNumber
- true if week numbers should be displayed,
false otherwisepublic void setDaysOfTheWeek(String[] days)
Calendar.SUNDAY
. If null, the representation provided
by the MonthViewUI is used.
The default value is the representation as
returned from the MonthViewUI.
days
- Array of characters that represents each day
IllegalArgumentException
- if not null and days.length
!=
DAYS_IN_WEEKpublic String[] getDaysOfTheWeek()
setDaysOfTheWeek(String[])
,
MonthViewUI
public String getDayOfTheWeek(int dayOfWeek)
dayOfWeek
-
public int getBoxPaddingX()
public void setBoxPaddingX(int boxPaddingX)
boxPaddingX
- Number of pixels applied to both sides of a daypublic int getBoxPaddingY()
public void setBoxPaddingY(int boxPaddingY)
boxPaddingY
- Number of pixels applied to top and bottom of a daypublic Color getSelectionBackground()
public void setSelectionBackground(Color c)
c
. The default color
is installed by the ui.
c
- Selected background.public Color getSelectionForeground()
public void setSelectionForeground(Color c)
c
. The default color
is installed by the ui.
c
- Selected foreground.public Color getTodayBackground()
public void setTodayBackground(Color c)
JXMonthView
component.
c
- color to setpublic Color getMonthStringBackground()
public void setMonthStringBackground(Color c)
138, 173, 209 (Blue-ish)
.
c
- color to setpublic Color getMonthStringForeground()
public void setMonthStringForeground(Color c)
Color.WHITE
.
c
- color to setpublic void setDaysOfTheWeekForeground(Color c)
c
- color to setpublic Color getDaysOfTheWeekForeground()
public void setDayForeground(int dayOfWeek, Color c)
PENDING JW: this is not a property - should it be and fire a change notification? If so, how?
dayOfWeek
- constant value defining the day of the week.c
- The color to be used for painting the numeric day of the week.public Color getDayForeground(int dayOfWeek)
dayOfWeek
- The day of week to get the color for.
public Color getPerDayOfWeekForeground(int dayOfWeek)
dayOfWeek
- The day of week to get the color for.
public void setFlaggedDayForeground(Color c)
c
- The color to be used for painting.public Color getFlaggedDayForeground()
public Insets getMonthStringInsets()
public void setMonthStringInsets(Insets insets)
insets
- Insetspublic int getPreferredColumnCount()
setPreferredColumnCount(int)
public void setPreferredColumnCount(int cols)
cols
- The number of columns of calendars.getPreferredColumnCount()
public int getPreferredRowCount()
setPreferredRowCount(int)
public void setPreferredRowCount(int rows)
rows
- The number of rows of calendars.getPreferredRowCount()
public void removeNotify()
KeyboardAction
s
set up in the the chain of parent components are removed.
removeNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public void addNotify()
KeyboardAction
event listeners.
addNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public void commitSelection()
Resets the model's adjusting property to false and fires an ActionEvent with the COMMIT_KEY action command.
cancelSelection()
,
DateSelectionModel.setAdjusting(boolean)
public void cancelSelection()
Resets the model's adjusting property to false and fires an ActionEvent with the CANCEL_KEY action command.
commitSelection()
,
DateSelectionModel.setAdjusting(boolean)
public void setComponentInputMapEnabled(boolean enabled)
If enabled, the keybinding for WHEN_IN_FOCUSED_WINDOW are installed, otherwise not. Changing this property will install/clear the corresponding key bindings. Typically, clients which want to use the monthview in a popup, should enable these.
The default value is false.
enabled
- boolean to indicate whether the component
input map should be enabled.isComponentInputMapEnabled()
public boolean isComponentInputMapEnabled()
setComponentInputMapEnabled(boolean)
public void addActionListener(ActionListener l)
Note that actionEvents are typically fired after a dedicated user gesture to end an ongoing selectin (like ENTER, ESCAPE) or after explicit programmatic commits/cancels. It is usually not fired after each change to the selection state. Client code which wants to be notified about all selection changes should register a DateSelectionListener to the DateSelectionModel.
l
- The ActionListener that is to be notifiedcommitSelection()
,
cancelSelection()
,
getSelectionModel()
public void removeActionListener(ActionListener l)
l
- The ActionListener to remove.public <T extends EventListener> T[] getListeners(Class<T> listenerType)
javax.swing.JComponent
FooListener
s
upon this JComponent
.
FooListener
s are registered using the
addFooListener
method.
You can specify the listenerType
argument
with a class literal,
such as
FooListener.class
.
For example, you can query a
JComponent
c
for its mouse listeners with the following code:
MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class));If no such listeners exist, this method returns an empty array.
getListeners
in class JComponent
listenerType
- the type of listeners requested; this parameter
should specify an interface that descends from
java.util.EventListener
FooListener
s on this component,
or an empty array if no such
listeners have been addedJComponent.getVetoableChangeListeners()
,
JComponent.getAncestorListeners()
protected void fireActionPerformed(String actionCommand)
actionCommand
- the command for the created.@Deprecated protected void cleanupWeekSelectionDates(Date startDate, Date endDate)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |