Sky View Café - Java

org.shetline.gui
Class MiniCalendar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.shetline.gui.KPanel
                      extended by org.shetline.gui.MiniCalendar
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class MiniCalendar
extends KPanel
implements ActionListener

See Also:
Serialized Form

Nested Class Summary
protected  class MiniCalendar.ArrowButton
           
static class MiniCalendar.CalendarControl
           
protected  class MiniCalendar.Cell
           
protected  class MiniCalendar.Day
           
protected  class MiniCalendar.Heading
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static KeyStroke ALT_LEFT_KEY
           
protected static KeyStroke ALT_RIGHT_KEY
           
protected  int ascent
           
protected static int BUTTON_SIZE
           
protected  KCalendar calendar
           
protected  int cellHPadding
           
protected  int cellSpacing
           
protected  int cellVPadding
           
protected static String CMD_MONTH_LEFT
           
protected static String CMD_MONTH_RIGHT
           
protected static String CMD_NAV_DOWN
           
protected static String CMD_NAV_LEFT
           
protected static String CMD_NAV_RIGHT
           
protected static String CMD_NAV_UP
           
protected static String CMD_SELECT
           
protected  boolean compactForm
           
static String DATE_CHANGED
           
static String DATE_CLICKED
           
protected  String[] daysOfTheWeek
           
protected static Color DEFAULT_HEADING_COLOR
           
protected static Color DEFAULT_HIGHLIGHT_COLOR
           
protected static Color DEFAULT_OTHER_MONTH_COLOR
           
protected static Color DEFAULT_WEEKDAY_COLOR
           
protected static Color DEFAULT_WEEKEND_COLOR
           
protected  int displayDate
           
protected  int displayMonth
           
protected  int displayYear
           
protected static KeyStroke DOWN_KEY
           
protected static KeyStroke ENTER_KEY
           
protected  MiniCalendar.Cell firstCell
           
protected  int firstDayOfWeek
           
protected  MiniCalendar.Cell focusCell
           
protected static int HEADER_ITEM_GAP
           
protected  MiniCalendar.Heading heading
           
protected  Color headingColor
           
protected  KPanel headingPanel
           
protected  Color highlightColor
           
protected  boolean initDone
           
protected  Font lastFont
           
protected  Locale lastLocale
           
protected  KGridBagLayout layout
           
protected static KeyStroke LEFT_KEY
           
protected  ImageButton leftMonthButton
           
protected  boolean leftToRight
           
protected  ImageButton leftYearButton
           
protected  int lineHeight
           
protected  ListenerHandler listenerHandler
           
protected  int maxYear
           
protected  int minYear
           
protected  String[] months
           
protected  Color otherMonthColor
           
protected  Popup popup
           
protected  boolean popupMode
           
protected  Graphics presizeGraphics
           
protected static KeyStroke RIGHT_KEY
           
protected  ImageButton rightMonthButton
           
protected  ImageButton rightYearButton
           
static Date SAMPLE_BC_DATE
           
protected  boolean showBC
           
protected  boolean showSelection
           
protected static KeyStroke SPACE_KEY
           
protected static KeyStroke UP_KEY
           
protected  Color weekdayColor
           
protected  Color weekendColor
           
protected  Set<Integer> weekendDays
           
protected  int widestDay
           
protected  int widestHeading
           
protected  DateFormat yearFormat
           
protected  String yearSizer
           
 
Fields inherited from class org.shetline.gui.KPanel
maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidth
 
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
MiniCalendar()
           
 
Method Summary
 void actionPerformed(ActionEvent event)
           
 void addActionListener(ActionListener listener)
           
 void addActionListener(ActionListener listener, boolean addWeakly)
           
 void addNotify()
           
protected  void adjustYearSizing()
           
protected  void arrangeCalendar()
           
protected  void broadcastChange(String eventMessage)
           
protected  void cancelPopup()
           
protected  MiniCalendar.Day createDay()
           
protected  MiniCalendar.Heading createHeading()
           
protected  GregorianCalendar getCalendar()
           
 JComponent getComponent(MiniCalendar.CalendarControl which)
           
 Date getDate()
           
 int[] getDateArray()
           
 Graphics getGraphics()
           
 Date getGregorianChange()
           
 int[] getGregorianChangeArray()
           
 Color getHeadingColor()
           
 Color getHighlightColor()
           
 Dimension getInnerSize()
           
 int getMaximumYear()
           
 Dimension getMinimumInnerSize()
           
 int getMinimumYear()
           
 Color getOtherMonthColor()
           
 Popup getPopup()
           
 boolean getPopupMode()
           
 Dimension getPreferredInnerSize()
           
protected  MiniCalendar.Day getSelectedDay()
           
 boolean getShowBC()
           
 boolean getShowSelection()
           
 TimeZone getTimeZone()
           
 Color getWeekdayColor()
           
 Color getWeekendColor()
           
 boolean isUndefined()
           
protected  int maxStringLength(String[] sa)
           
protected  void performMonthLeft()
           
protected  void performMonthRight()
           
 void presize(Graphics g)
           
 void removeActionListener(ActionListener listener)
           
 void requestDayFocus()
           
 void setDate(Date date)
           
 void setDate(Date date, boolean silently)
           
 void setDate(Date date, TimeZone zone)
           
 void setDate(Date date, TimeZone zone, boolean silently)
           
 void setDate(int[] ymd)
           
 void setDate(int[] ymd, boolean silently)
           
 void setDate(int year, int month, int day)
           
 void setDate(int year, int month, int day, boolean silently)
           
protected  void setDate(int year, int month, int day, boolean silently, String eventMessage)
           
protected  void setEnabledWithFocusCheck(Component comp, Component alt, boolean enabled)
           
 void setFont(Font font)
           
 void setForeground(Color color)
           
 void setGregorianChange(Date date)
           
 void setGregorianChange(int[] ymd)
           
 void setGregorianChange(int year, int month, int date)
           
 void setHeadingColor(Color color)
           
 void setHighlightColor(Color color)
           
 void setLocale(Locale locale)
           
 void setMaximumYear(int year)
           
 void setMinimumYear(int year)
           
 void setOtherMonthColor(Color color)
           
 void setPopup(Popup popup)
           
 void setPopupMode(boolean state)
           
 void setShowBC(boolean show)
           
 void setShowSelection(boolean state)
           
 void setSpacing(boolean compact, int hpad, int vpad, int spacing)
           
 void setTimeZone(TimeZone zone)
           
 void setUndefined()
           
 void setUndefined(boolean silently)
           
 void setWeekdayColor(Color color)
           
 void setWeekendColor(Color color)
           
protected  void shortenDayOfTheWeekNames()
           
protected  void updateForFont(boolean force)
           
protected  void updateForLocale()
           
 
Methods inherited from class org.shetline.gui.KPanel
beep, getInsets, getInsetsWithinBorder, getMaximumHeight, getMaximumInnerSize, getMaximumSize, getMaximumWidth, getMinimumHeight, getMinimumSize, getMinimumWidth, getPreferredHeight, getPreferredSize, getPreferredWidth, getScreenSize, paintComponent, paintInnerComponent, processInnerMouseEvent, processInnerMouseMotionEvent, processMouseEvent, processMouseMotionEvent, setInsets, setInsets, setInsets, setMaximumHeight, setMaximumWidth, setMinimumHeight, setMinimumWidth, setPreferredHeight, setPreferredWidth
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, 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, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, 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, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ascent

protected int ascent

calendar

protected KCalendar calendar

cellHPadding

protected int cellHPadding

cellSpacing

protected int cellSpacing

cellVPadding

protected int cellVPadding

compactForm

protected boolean compactForm

displayDate

protected int displayDate

displayMonth

protected int displayMonth

displayYear

protected int displayYear

daysOfTheWeek

protected String[] daysOfTheWeek

firstCell

protected MiniCalendar.Cell firstCell

firstDayOfWeek

protected int firstDayOfWeek

focusCell

protected MiniCalendar.Cell focusCell

heading

protected MiniCalendar.Heading heading

headingPanel

protected KPanel headingPanel

headingColor

protected Color headingColor

highlightColor

protected Color highlightColor

initDone

protected boolean initDone

lastFont

protected Font lastFont

lastLocale

protected Locale lastLocale

layout

protected KGridBagLayout layout

leftToRight

protected boolean leftToRight

lineHeight

protected int lineHeight

listenerHandler

protected ListenerHandler listenerHandler

maxYear

protected int maxYear

minYear

protected int minYear

months

protected String[] months

otherMonthColor

protected Color otherMonthColor

popup

protected Popup popup

popupMode

protected boolean popupMode

presizeGraphics

protected Graphics presizeGraphics

showBC

protected boolean showBC

showSelection

protected boolean showSelection

weekdayColor

protected Color weekdayColor

weekendColor

protected Color weekendColor

weekendDays

protected Set<Integer> weekendDays

widestDay

protected int widestDay

widestHeading

protected int widestHeading

yearFormat

protected DateFormat yearFormat

yearSizer

protected String yearSizer

leftYearButton

protected ImageButton leftYearButton

leftMonthButton

protected ImageButton leftMonthButton

rightMonthButton

protected ImageButton rightMonthButton

rightYearButton

protected ImageButton rightYearButton

DEFAULT_HEADING_COLOR

protected static final Color DEFAULT_HEADING_COLOR

DEFAULT_OTHER_MONTH_COLOR

protected static final Color DEFAULT_OTHER_MONTH_COLOR

DEFAULT_WEEKDAY_COLOR

protected static final Color DEFAULT_WEEKDAY_COLOR

DEFAULT_WEEKEND_COLOR

protected static final Color DEFAULT_WEEKEND_COLOR

DEFAULT_HIGHLIGHT_COLOR

protected static final Color DEFAULT_HIGHLIGHT_COLOR

BUTTON_SIZE

protected static final int BUTTON_SIZE
See Also:
Constant Field Values

HEADER_ITEM_GAP

protected static final int HEADER_ITEM_GAP
See Also:
Constant Field Values

ENTER_KEY

protected static final KeyStroke ENTER_KEY

SPACE_KEY

protected static final KeyStroke SPACE_KEY

UP_KEY

protected static final KeyStroke UP_KEY

DOWN_KEY

protected static final KeyStroke DOWN_KEY

LEFT_KEY

protected static final KeyStroke LEFT_KEY

RIGHT_KEY

protected static final KeyStroke RIGHT_KEY

ALT_LEFT_KEY

protected static final KeyStroke ALT_LEFT_KEY

ALT_RIGHT_KEY

protected static final KeyStroke ALT_RIGHT_KEY

CMD_MONTH_LEFT

protected static final String CMD_MONTH_LEFT
See Also:
Constant Field Values

CMD_MONTH_RIGHT

protected static final String CMD_MONTH_RIGHT
See Also:
Constant Field Values

CMD_NAV_LEFT

protected static final String CMD_NAV_LEFT
See Also:
Constant Field Values

CMD_NAV_RIGHT

protected static final String CMD_NAV_RIGHT
See Also:
Constant Field Values

CMD_NAV_UP

protected static final String CMD_NAV_UP
See Also:
Constant Field Values

CMD_NAV_DOWN

protected static final String CMD_NAV_DOWN
See Also:
Constant Field Values

CMD_SELECT

protected static final String CMD_SELECT
See Also:
Constant Field Values

DATE_CHANGED

public static final String DATE_CHANGED
See Also:
Constant Field Values

DATE_CLICKED

public static final String DATE_CLICKED
See Also:
Constant Field Values

SAMPLE_BC_DATE

public static final Date SAMPLE_BC_DATE
Constructor Detail

MiniCalendar

public MiniCalendar()
Method Detail

getComponent

public JComponent getComponent(MiniCalendar.CalendarControl which)

setDate

public void setDate(int year,
                    int month,
                    int day)

setDate

public void setDate(int year,
                    int month,
                    int day,
                    boolean silently)

setDate

protected void setDate(int year,
                       int month,
                       int day,
                       boolean silently,
                       String eventMessage)

setDate

public void setDate(int[] ymd)

setDate

public void setDate(int[] ymd,
                    boolean silently)

setDate

public void setDate(Date date,
                    TimeZone zone)

setDate

public void setDate(Date date,
                    TimeZone zone,
                    boolean silently)

setDate

public void setDate(Date date)

setDate

public void setDate(Date date,
                    boolean silently)

getTimeZone

public TimeZone getTimeZone()

setTimeZone

public void setTimeZone(TimeZone zone)

getCalendar

protected GregorianCalendar getCalendar()

getDate

public Date getDate()

getDateArray

public int[] getDateArray()

setUndefined

public void setUndefined()

setUndefined

public void setUndefined(boolean silently)

isUndefined

public boolean isUndefined()

setGregorianChange

public void setGregorianChange(Date date)

setGregorianChange

public void setGregorianChange(int[] ymd)

setGregorianChange

public void setGregorianChange(int year,
                               int month,
                               int date)

getGregorianChange

public final Date getGregorianChange()

getGregorianChangeArray

public int[] getGregorianChangeArray()

getMinimumYear

public int getMinimumYear()

setMinimumYear

public void setMinimumYear(int year)

getMaximumYear

public int getMaximumYear()

setMaximumYear

public void setMaximumYear(int year)

setShowBC

public void setShowBC(boolean show)

getShowBC

public boolean getShowBC()

setShowSelection

public void setShowSelection(boolean state)

getShowSelection

public boolean getShowSelection()

setLocale

public void setLocale(Locale locale)
Overrides:
setLocale in class Component

setFont

public void setFont(Font font)
Overrides:
setFont in class JComponent

setForeground

public void setForeground(Color color)
Overrides:
setForeground in class JComponent

getHeadingColor

public Color getHeadingColor()

setHeadingColor

public void setHeadingColor(Color color)

getHighlightColor

public Color getHighlightColor()

setHighlightColor

public void setHighlightColor(Color color)

getOtherMonthColor

public Color getOtherMonthColor()

setOtherMonthColor

public void setOtherMonthColor(Color color)

setSpacing

public void setSpacing(boolean compact,
                       int hpad,
                       int vpad,
                       int spacing)

getPopupMode

public boolean getPopupMode()

setPopupMode

public void setPopupMode(boolean state)

getPopup

public Popup getPopup()

setPopup

public void setPopup(Popup popup)

cancelPopup

protected void cancelPopup()

getWeekdayColor

public Color getWeekdayColor()

setWeekdayColor

public void setWeekdayColor(Color color)

getWeekendColor

public Color getWeekendColor()

setWeekendColor

public void setWeekendColor(Color color)

addActionListener

public void addActionListener(ActionListener listener)

addActionListener

public void addActionListener(ActionListener listener,
                              boolean addWeakly)

removeActionListener

public void removeActionListener(ActionListener listener)

addNotify

public void addNotify()
Overrides:
addNotify in class JComponent

adjustYearSizing

protected void adjustYearSizing()

arrangeCalendar

protected void arrangeCalendar()

setEnabledWithFocusCheck

protected void setEnabledWithFocusCheck(Component comp,
                                        Component alt,
                                        boolean enabled)

updateForLocale

protected void updateForLocale()

maxStringLength

protected int maxStringLength(String[] sa)

shortenDayOfTheWeekNames

protected void shortenDayOfTheWeekNames()

updateForFont

protected void updateForFont(boolean force)

getGraphics

public Graphics getGraphics()
Overrides:
getGraphics in class JComponent

presize

public void presize(Graphics g)

getSelectedDay

protected MiniCalendar.Day getSelectedDay()

requestDayFocus

public void requestDayFocus()

getMinimumInnerSize

public Dimension getMinimumInnerSize()
Overrides:
getMinimumInnerSize in class KPanel

getPreferredInnerSize

public Dimension getPreferredInnerSize()
Overrides:
getPreferredInnerSize in class KPanel

getInnerSize

public Dimension getInnerSize()
Overrides:
getInnerSize in class KPanel

actionPerformed

public void actionPerformed(ActionEvent event)
Specified by:
actionPerformed in interface ActionListener

broadcastChange

protected void broadcastChange(String eventMessage)

performMonthLeft

protected void performMonthLeft()

performMonthRight

protected void performMonthRight()

createDay

protected MiniCalendar.Day createDay()

createHeading

protected MiniCalendar.Heading createHeading()

Sky View Café - Java