|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.plaf.ComponentUI
org.jdesktop.swingx.plaf.MonthViewUI
org.jdesktop.swingx.plaf.basic.BasicMonthViewUI
public class BasicMonthViewUI
Field Summary | |
---|---|
protected static SimpleDateFormat |
dayOfMonthFormatter
Formatter used to format the day of the week to a numerical value. |
protected Font |
derivedFont
Used as the font for flagged days. |
protected long |
firstDisplayedDate
|
protected int |
firstDisplayedMonth
|
protected int |
firstDisplayedYear
|
protected long |
lastDisplayedDate
|
protected Icon |
monthDownImage
|
protected Icon |
monthUpImage
|
protected JXMonthView |
monthView
|
protected SortedSet<Date> |
selection
|
protected long |
today
|
Constructor Summary | |
---|---|
BasicMonthViewUI()
|
Method Summary | |
---|---|
long |
calculateLastDisplayedDate()
Calculate the last possible date that can be displayed. |
protected Font |
createDerivedFont()
Create a derived font used to when painting various pieces of the month view component. |
protected LayoutManager |
createLayoutManager()
|
protected MouseListener |
createMouseListener()
|
protected MouseMotionListener |
createMouseMotionListener()
|
protected PropertyChangeListener |
createPropertyChangeListener()
|
static ComponentUI |
createUI(JComponent c)
|
protected Point |
getCalRowColAt(int x,
int y)
Get the row and column for the calendar at the specified coordinates |
long |
getDayAt(int x,
int y)
Return a long representing the date at the specified x/y position. |
protected int |
getDayOfTheWeek()
Convenience method so subclasses can get the currently painted day's day of the week. |
protected int |
getTraversableButtonAt(int x,
int y)
Returns an index defining which, if any, of the buttons for traversing the month was pressed. |
protected void |
installComponents()
|
protected void |
installDefaults()
|
protected void |
installKeyboardActions()
|
protected void |
installListeners()
|
void |
installUI(JComponent c)
Configures the specified component appropriate for the look and feel. |
protected boolean |
isToday(long date)
Returns true if the date passed in is the same as today. |
boolean |
isUsingKeyboard()
|
void |
paint(Graphics g,
JComponent c)
Paints the specified component appropriate for the look and feel. |
protected void |
paintBackground(Rectangle clip,
Graphics g)
|
protected void |
paintDayBackground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the background for the specified day. |
protected void |
paintDayForeground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the foreground for the specified day. |
protected void |
paintDayOfTheWeekBackground(Graphics g,
int x,
int y,
int width,
int height)
|
protected void |
paintFlaggedDayBackground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the background for the specified flagged day. |
protected void |
paintFlaggedDayForeground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the foreground for the specified flagged day. |
protected void |
paintLeadingDayBackground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the background for the specified leading day. |
protected void |
paintLeadingDayForeground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the foreground for the specified leading day. |
protected void |
paintMonthStringBackground(Graphics g,
int x,
int y,
int width,
int height)
Paints the background of the month string. |
protected void |
paintMonthStringForeground(Graphics g,
int x,
int y,
int width,
int height)
|
protected void |
paintTrailingDayBackground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the background for the specified trailing day. |
protected void |
paintTrailingDayForeground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the foreground for the specified trailing day. |
protected void |
paintUnselectableDayBackground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the foreground for the specified unselectable day. |
protected void |
paintUnselectableDayForeground(Graphics g,
int x,
int y,
int width,
int height,
long date)
Paint the foreground for the specified unselectable day. |
protected void |
paintWeekOfYearBackground(Graphics g,
int x,
int y,
int width,
int height)
|
protected void |
paintWeekOfYearForeground(Graphics g,
int x,
int y,
int width,
int height,
int weekOfYear)
Paints the week of the year |
void |
setUsingKeyboard(boolean val)
|
protected void |
uninstallComponents()
|
protected void |
uninstallDefaults()
|
protected void |
uninstallKeyboardActions()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent c)
Reverses configuration which was done on the specified component during installUI . |
Methods inherited from class javax.swing.plaf.ComponentUI |
---|
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final SimpleDateFormat dayOfMonthFormatter
protected JXMonthView monthView
protected long firstDisplayedDate
protected int firstDisplayedMonth
protected int firstDisplayedYear
protected long lastDisplayedDate
protected long today
protected SortedSet<Date> selection
protected Font derivedFont
protected Icon monthUpImage
protected Icon monthDownImage
Constructor Detail |
---|
public BasicMonthViewUI()
Method Detail |
---|
public static ComponentUI createUI(JComponent c)
public void installUI(JComponent c)
javax.swing.plaf.ComponentUI
ComponentUI
instance is being installed
as the UI delegate on the specified component. This method should
completely configure the component for the look and feel,
including the following:
LayoutManager
on the component if necessary.
PropertyChangeListener
on the component in order
to detect and respond to component property changes appropriately.
installUI
in class ComponentUI
c
- the component where this UI delegate is being installedComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void uninstallUI(JComponent c)
javax.swing.plaf.ComponentUI
installUI
. This method is invoked when this
UIComponent
instance is being removed as the UI delegate
for the specified component. This method should undo the
configuration performed in installUI
, being careful to
leave the JComponent
instance in a clean state (no
extraneous listeners, look-and-feel-specific property objects, etc.).
This should include the following:
uninstallUI
in class ComponentUI
c
- the component from which this UI delegate is being removed;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected void installComponents()
protected void uninstallComponents()
protected void installDefaults()
protected void uninstallDefaults()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
protected void installListeners()
protected void uninstallListeners()
protected PropertyChangeListener createPropertyChangeListener()
protected LayoutManager createLayoutManager()
protected MouseListener createMouseListener()
protected MouseMotionListener createMouseMotionListener()
protected Font createDerivedFont()
public boolean isUsingKeyboard()
public void setUsingKeyboard(boolean val)
protected boolean isToday(long date)
date
- long representing the date you want to compare to today.
public long getDayAt(int x, int y)
MonthViewUI
getDayAt
in class MonthViewUI
x
- X positiony
- Y position
protected int getDayOfTheWeek()
Calendar
protected int getTraversableButtonAt(int x, int y)
setTraversable
is set to true.
x
- x position of the pointery
- y position of the pointer
protected Point getCalRowColAt(int x, int y)
x
- x locationy
- y location
Point
object containing the row as the x value
and column as the y valuepublic long calculateLastDisplayedDate()
MonthViewUI
calculateLastDisplayedDate
in class MonthViewUI
public void paint(Graphics g, JComponent c)
javax.swing.plaf.ComponentUI
ComponentUI.update
method when
the specified component is being painted. Subclasses should override
this method and use the specified Graphics
object to
render the content of the component.
paint
in class ComponentUI
g
- the Graphics
context in which to paintc
- the component being painted;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintDayOfTheWeekBackground(Graphics g, int x, int y, int width, int height)
protected void paintWeekOfYearBackground(Graphics g, int x, int y, int width, int height)
protected void paintWeekOfYearForeground(Graphics g, int x, int y, int width, int height, int weekOfYear)
g
- Graphics objectx
- x-coordinate of upper left corner.y
- y-coordinate of upper left corner.width
- width of bounding boxheight
- height of bounding boxweekOfYear
- week of the yearprotected void paintMonthStringBackground(Graphics g, int x, int y, int width, int height)
g
- Graphics object to paint to.x
- x-coordinate of upper left corner.y
- y-coordinate of upper left corner.width
- width of the bounding box.height
- height of the bounding box.JXMonthView.setMonthStringBackground(java.awt.Color)
,
JXMonthView.setMonthStringInsets(java.awt.Insets)
protected void paintMonthStringForeground(Graphics g, int x, int y, int width, int height)
protected void paintDayBackground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the day being paintedJXMonthView.isSelectedDate(long)
,
isToday(long)
protected void paintDayForeground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the day being paintedprotected void paintFlaggedDayBackground(Graphics g, int x, int y, int width, int height, long date)
paintDayBackground
.
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the flagged day being paintedprotected void paintFlaggedDayForeground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the flagged day being paintedprotected void paintUnselectableDayBackground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the flagged day being paintedprotected void paintUnselectableDayForeground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the flagged day being paintedprotected void paintLeadingDayBackground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the leading day being paintedprotected void paintLeadingDayForeground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the leading day being paintedprotected void paintTrailingDayBackground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the leading day being paintedprotected void paintTrailingDayForeground(Graphics g, int x, int y, int width, int height, long date)
g
- Graphics object to paint tox
- x-coordinate of upper left cornery
- y-coordinate of upper left cornerwidth
- width of bounding box for the dayheight
- height of bounding box for the daydate
- long value representing the leading day being paintedprotected void paintBackground(Rectangle clip, Graphics g)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |