public interface IlvCalendarCellRenderer
IlvJCalendarPanel
. For example, to use a
JLabel
we suggest that you subclass
IlvAbstractCellRenderer
for the best
performance. Your renderer would then be something like this:
class MyCellRenderer extends IlvAbstractCellRenderer implements IlvCalendarCellRenderer { NumberFormat format = NumberFormat.getNumberInstance(); public Component getCalendarCellRendererComponent( IlvJCalendarPanel calendarPanel, Calendar calendar, int row, int column, boolean isPrevMonth, boolean isNextMonth, boolean isSelected, boolean hasFocus) { setText(format.format(calendar.get(Calendar.DAY_OF_MONTH))); setFont(calendarPanel.getFont()); setBackground(isSelected ? calendarPanel.getSelectionBackground() : calendarPanel.getBackground()); setForeground(isSelected ? calendarPanel.getSelectionForeground() : calendarPanel.getForeground()); return this; } }
Modifier and Type | Method and Description |
---|---|
Component |
getCalendarCellRendererComponent(IlvJCalendarPanel calendarPanel,
Calendar calendar,
int row,
int column,
boolean isPrevMonth,
boolean isNextMonth,
boolean isSelected,
boolean hasFocus)
Returns a component that has been configured to render the specified day
cell and value.
|
Component getCalendarCellRendererComponent(IlvJCalendarPanel calendarPanel, Calendar calendar, int row, int column, boolean isPrevMonth, boolean isNextMonth, boolean isSelected, boolean hasFocus)
paint
method is then called
to "render" the cell.calendarPanel
- The IlvJCalendarPanel
that is asking the
renderer to draw.calendar
- The calendar value of the cell.row
- The row index of the cell being drawn.column
- The column index of the cell being drawn.isPrevMonth
- Indicates if the cell is in the month prior to the
current month displayed by the calendar panel.isNextMonth
- Indicates if the cell is in the month after the
current month displayed by the calendar panel.isSelected
- Indicates if the cell is selected.hasFocus
- Indicates if the cell has the focus.paint()
method will render the cell
and value.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.