public class IlvJCalendarPanel extends JComponent
IlvJCalendarPanel
is a Swing component that renders a monthly
calendar grid.
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
CELL_RENDERER_CHANGED_PROPERTY
Identifies that the calendar panel's cell renderer has changed.
|
static String |
DATE_SELECTED_PROPERTY
Identifies that a user input event has selected a date in the panel.
|
static String |
HEADER_BACKGROUND_CHANGED_PROPERTY
Identifies the background color of the header.
|
static String |
HEADER_FONT_CHANGED_PROPERTY
Identifies the font of the header.
|
static String |
HEADER_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the header.
|
static String |
HEADER_HEIGHT_CHANGED_PROPERTY
Identifies that the height of the calendar panel's header has changed.
|
static String |
HEADER_RENDERER_CHANGED_PROPERTY
Identifies that the calendar panel's header renderer has changed.
|
static String |
MODEL_CHANGED_PROPERTY
Identifies that the panel's calendar model has changed.
|
static String |
NEXT_MONTH_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the next month.
|
static String |
PREVIOUS_MONTH_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the previous month.
|
static String |
SELECTION_BACKGROUND_CHANGED_PROPERTY
Identifies the background color of the selection.
|
static String |
SELECTION_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the selection.
|
static String |
WEEKEND_BACKGROUND_CHANGED_PROPERTY
Identifies the background color of the weekends.
|
static String |
WEEKEND_FONT_CHANGED_PROPERTY
Identifies the font of the weekends.
|
static String |
WEEKEND_FOREGROUND_CHANGED_PROPERTY
Identifies the foreground color of the weekends.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvJCalendarPanel()
Creates a new
IlvJCalendarPanel that is initialized with a default data
model. |
IlvJCalendarPanel(IlvCalendarModel model)
Creates a new
IlvJCalendarPanel that is initialized with the specified
data model. |
Modifier and Type | Method and Description |
---|---|
protected IlvCalendarModel |
createDefaultModel()
Returns the default calendar model object for this panel, which is an
IlvDefaultCalendarModel . |
void |
fireDateSelected()
Fires a
PropertyChange event to all subscribed listeners indicating that
the user has selected a date in the panel. |
Calendar |
getCalendar()
Returns the calendar displayed by the panel.
|
Calendar |
getCellDate(int row,
int column)
Returns the date displayed in the day cell that lies at the intersection of the
specified week
row and day-of-week column . |
Rectangle |
getCellRect(int row,
int column)
Returns a rectangle for the day cell that lies at the intersection of the specified
week
row and day-of-week column . |
IlvCalendarCellRenderer |
getCellRenderer()
Returns the object that renders the day cells.
|
int |
getColumnAtPoint(Point point)
Returns the index of the day-of-week column that
point lies in. |
int |
getColumnCount()
Returns the number of day-of-week columns in the calendar panel.
|
int |
getColumnWidth()
Returns the width of the day-of-week columns.
|
Color |
getHeaderBackground()
Returns the header background color.
|
Font |
getHeaderFont()
Returns the header font.
|
Color |
getHeaderForeground()
Returns the header foreground color.
|
int |
getHeaderHeight()
Returns the height of the days-of-week header, in pixels.
|
IlvCalendarHeaderRenderer |
getHeaderRenderer()
Returns the object that renders the day-of-week header.
|
IlvCalendarModel |
getModel()
Returns the data model that holds the calendar displayed by the panel.
|
Color |
getNextMonthForeground()
Returns the next month foreground color.
|
Color |
getPreviousMonthForeground()
Returns the previous month foreground color.
|
int |
getRowAtPoint(Point point)
Returns the index of the week row that
point lies in. |
int |
getRowCount()
Returns the number of week rows in the calendar panel.
|
int |
getRowHeight()
Returns the height of the week rows.
|
Color |
getSelectionBackground()
Returns the selection background color.
|
Color |
getSelectionForeground()
Returns the selection foreground color.
|
CalendarPanelUI |
getUI()
Returns the look and feel (L&F) object that renders this calendar panel.
|
String |
getUIClassID()
Returns the suffix used to construct the name of the look and feel (L&F) class used
to render this component.
|
Color |
getWeekendBackground()
Returns the weekend background color.
|
Font |
getWeekendFont()
Returns the weekend font.
|
Color |
getWeekendForeground()
Returns the weekend foreground color.
|
protected void |
init()
Initializes calendar panel properties to their default values.
|
boolean |
isFocusTraversable()
Returns whether the focus can be traversed.
|
void |
setCalendar(Calendar calendar)
Sets the calendar displayed by the panel.
|
void |
setCellRenderer(IlvCalendarCellRenderer cellRenderer)
Sets the object that renders the day cells.
|
void |
setHeaderBackground(Color headerBackground)
Sets the background color for the days-of-week header cells.
|
void |
setHeaderFont(Font headerFont)
Sets the font for header cells.
|
void |
setHeaderForeground(Color headerForeground)
Sets the foreground color for selected cells.
|
void |
setHeaderHeight(int headerHeight)
Sets the height of the days-of-week header, in pixels.
|
void |
setHeaderRenderer(IlvCalendarHeaderRenderer headerRenderer)
Sets the object that renders the day-of-week header.
|
void |
setModel(IlvCalendarModel model)
Sets the data model that holds the calendar displayed by the panel.
|
void |
setNextMonthForeground(Color nextMonthForeground)
Sets the foreground color for the next month cells.
|
void |
setPreviousMonthForeground(Color previousMonthForeground)
Sets the foreground color for the previous month cells.
|
void |
setSelectionBackground(Color selectionBackground)
Sets the background color for selected cells.
|
void |
setSelectionForeground(Color selectionForeground)
Sets the foreground color for selected cells.
|
void |
setUI(CalendarPanelUI ui)
Sets the look and feel (L&F) object that renders this calendar panel.
|
void |
setWeekendBackground(Color weekendBackground)
Sets the background color for selected cells.
|
void |
setWeekendFont(Font weekendFont)
Sets the font for weekend cells.
|
void |
setWeekendForeground(Color weekendForeground)
Sets the foreground color for weekend cells.
|
void |
updateUI()
Resets the UI property with the value from the current look and feel.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final String MODEL_CHANGED_PROPERTY
public static final String DATE_SELECTED_PROPERTY
public static final String CELL_RENDERER_CHANGED_PROPERTY
public static final String HEADER_RENDERER_CHANGED_PROPERTY
public static final String HEADER_HEIGHT_CHANGED_PROPERTY
public static final String SELECTION_FOREGROUND_CHANGED_PROPERTY
public static final String SELECTION_BACKGROUND_CHANGED_PROPERTY
public static final String WEEKEND_FOREGROUND_CHANGED_PROPERTY
public static final String WEEKEND_BACKGROUND_CHANGED_PROPERTY
public static final String WEEKEND_FONT_CHANGED_PROPERTY
public static final String PREVIOUS_MONTH_FOREGROUND_CHANGED_PROPERTY
public static final String NEXT_MONTH_FOREGROUND_CHANGED_PROPERTY
public static final String HEADER_FOREGROUND_CHANGED_PROPERTY
public static final String HEADER_BACKGROUND_CHANGED_PROPERTY
public static final String HEADER_FONT_CHANGED_PROPERTY
public IlvJCalendarPanel(IlvCalendarModel model)
IlvJCalendarPanel
that is initialized with the specified
data model.model
- The data model for the calendar panel.public IlvJCalendarPanel()
IlvJCalendarPanel
that is initialized with a default data
model.createDefaultModel()
protected void init()
public boolean isFocusTraversable()
isFocusTraversable
in class Component
true
if the focus is traversable, or false
otherwise.protected IlvCalendarModel createDefaultModel()
IlvDefaultCalendarModel
. A subclass can override this method to return a different
calendar model object.getModel()
,
setModel(ilog.views.util.swing.calendar.IlvCalendarModel)
public IlvCalendarModel getModel()
public void setModel(IlvCalendarModel model)
model
- The data model to set.getModel()
,
createDefaultModel()
public Calendar getCalendar()
setCalendar(java.util.Calendar)
public void setCalendar(Calendar calendar)
calendar
- The calendar to set.getCalendar()
public Calendar getCellDate(int row, int column)
row
and day-of-week column
. If the specified
cell coordinates are out of range, then null
is returned.row
- The week row.column
- The day-of-week column.public String getUIClassID()
getUIClassID
in class JComponent
public CalendarPanelUI getUI()
CalendarPanelUI
object that renders this component.public void setUI(CalendarPanelUI ui)
ui
- The CalendarPanelUI
L&F object.public void updateUI()
updateUI
in class JComponent
public void fireDateSelected()
PropertyChange
event to all subscribed listeners indicating that
the user has selected a date in the panel. Warning: This method
is considered to be part of an IlvJCalendarPanel
's internal
implementation and not a public API. This method should only be invoked by the
panel's LAF delegate.
public IlvCalendarCellRenderer getCellRenderer()
public void setCellRenderer(IlvCalendarCellRenderer cellRenderer)
cellRenderer
- The cell renderer object.getCellRenderer()
public IlvCalendarHeaderRenderer getHeaderRenderer()
public void setHeaderRenderer(IlvCalendarHeaderRenderer headerRenderer)
headerRenderer
- The day-of-week header renderer object.getHeaderRenderer()
public Color getSelectionForeground()
public void setSelectionForeground(Color selectionForeground)
selectionForeground
- The color.getSelectionForeground()
,
setSelectionBackground(java.awt.Color)
public Color getSelectionBackground()
public void setSelectionBackground(Color selectionBackground)
selectionBackground
- The color.getSelectionBackground()
,
setSelectionForeground(java.awt.Color)
public Color getWeekendForeground()
public void setWeekendForeground(Color weekendForeground)
weekendForeground
- The color.getWeekendForeground()
,
setWeekendBackground(java.awt.Color)
public Color getWeekendBackground()
public void setWeekendBackground(Color weekendBackground)
weekendBackground
- The color.getWeekendBackground()
,
setWeekendForeground(java.awt.Color)
public Font getWeekendFont()
setWeekendFont(java.awt.Font)
public void setWeekendFont(Font weekendFont)
weekendFont
- The font.getWeekendFont()
public Color getPreviousMonthForeground()
public void setPreviousMonthForeground(Color previousMonthForeground)
previousMonthForeground
- The color.getPreviousMonthForeground()
,
setNextMonthForeground(java.awt.Color)
public Color getNextMonthForeground()
public void setNextMonthForeground(Color nextMonthForeground)
nextMonthForeground
- The color.getNextMonthForeground()
,
setPreviousMonthForeground(java.awt.Color)
public Color getHeaderForeground()
public void setHeaderForeground(Color headerForeground)
headerForeground
- The color.getHeaderForeground()
,
setHeaderBackground(java.awt.Color)
public Color getHeaderBackground()
public void setHeaderBackground(Color headerBackground)
headerBackground
- The color.getHeaderBackground()
,
setHeaderForeground(java.awt.Color)
public Font getHeaderFont()
setHeaderFont(java.awt.Font)
public void setHeaderFont(Font headerFont)
headerFont
- The font.getHeaderFont()
public int getRowCount()
6
is determined by the look-and-feel implementation.public int getColumnCount()
7
is determined by the look-and-feel implementation.public void setHeaderHeight(int headerHeight)
headerHeight
- The new header height.getHeaderHeight()
public int getHeaderHeight()
setHeaderHeight(int)
public int getRowHeight()
public int getColumnWidth()
public Rectangle getCellRect(int row, int column)
row
and day-of-week column
. A value of -1 can be
specified for the row
to indicate the days-of-week header. If the
specified cell coordinates are out of range, then null
is returned.row
- The week row, or -1 to indicate the days-of-week header.column
- The day-of-week column.public int getRowAtPoint(Point point)
point
lies in. This method
returns -1 if the point lies in the days-of-week header. Otherwise, this method
returns -2 if the result is not in the range [0, getRowCount()
-1].point
- The location of interest.point
lies in, or -1 if
point
lies in the days-of-week header, or -2 if the result is
not in the range [0, getRowCount()
-1].getColumnAtPoint(java.awt.Point)
public int getColumnAtPoint(Point point)
point
lies in. This
method returns -1 if the point is not in the range [0, getColumnCount()
-1].point
- The location of interest.point
lies in, or -1 if
the result is not in the range [0, getColumnCount()
-1].getRowAtPoint(java.awt.Point)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.