com.zfqjava.swing
Class JCalendar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.zfqjava.swing.JCalendar
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JCalendar
extends javax.swing.JComponent
implements javax.accessibility.Accessible, java.awt.event.ActionListener

JCalendar provides a calendar component.
Client Property:
NameValueDefault Value
JCalendar.headerStyle
  • Classic_Arrow
  • Modern_Arrow
  • None
Classic_Arrow
JCalendar.centerStyle
  • MonthView
  • YearView
MonthView
JCalendar.footerStyle
  • Today
  • None
Today

See Also:
Serialized Form

Inner Class Summary
protected  class JCalendar.AccessibleJCalendar
          This class implements accessibility support for the JCalendar class.
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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
JCalendar()
          Constructs a JCalendar.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This method should not invoke by user.
 void addActionListener(java.awt.event.ActionListener listener)
          Adds an action listener to the JCalendar.
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a ChangeListener to the JCalendar component.
protected  void fireActionPerformed(java.awt.event.ActionEvent e)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireStateChanged()
          Notifies all listeners that have registered interest for notification on this event type.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JCalendar.
 java.awt.event.ActionListener[] getActionListeners()
          Returns an array of all the action listeners registered on this JCalendar.
 java.util.Calendar getCalendar()
          Returns the calendar object used by this JClock.
 CellProvider getCellProvider()
          Returns the cell provider for renderer.
 AbstractCellRenderer getCellRenderer()
          Returns the cell renderer for render day.
 javax.swing.event.ChangeListener[] getChangeListeners()
          Returns an array of all the ChangeListeners added to this JCalendar with addChangeListener().
 int getDate()
          Returns the calendar's current date.
 java.util.Calendar getModel()
          Deprecated. replaced by getCalendar()
 int getMonth()
          Returns the calendar's current month.
 java.util.Date getTime()
          Gets this Calendar's current time.
 CalendarUI getUI()
          Returns the look and feel (L&F) object that renders this component.
 java.lang.String getUIClassID()
          Returns a string that specifies the name of the L&F class that renders this component.
 int getYear()
          Returns this calendar's current year.
protected  java.lang.String paramString()
          Returns a string representation of this JCalendar.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes the specified action listener from the JCalendar.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes a ChangeListener from the JCalendar component.
 void setCalendar(java.util.Calendar cal)
          Sets the calendar object used by this JClock.
 void setCellProvider(CellProvider cellProvider)
          Sets the cell provider for renderer.
 void setCellRenderer(AbstractCellRenderer cellRenderer)
          Sets the cell renderer for render day.
 void setDate(int date)
          Sets the day of the month of this JCalendar object to the specified value.
 void setModel(java.util.Calendar cal)
          Deprecated. replaced by setCalendar(java.util.Calendar)
 void setMonth(int month)
          Sets the month of this date to the specified value.
 void setTime(java.util.Date time)
          Sets this Calendar's current time with the given Date.
 void setUI(CalendarUI ui)
          Sets the look and feel (L&F) object that renders this component.
 void setYear(int year)
          Sets the year of this JCalendar object to be the specified value.
 void updateUI()
          Resets the UI property with a value from the current look and feel.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JCalendar

public JCalendar()
Constructs a JCalendar.
Method Detail

updateUI

public void updateUI()
Resets the UI property with a value from the current look and feel.
Overrides:
updateUI in class javax.swing.JComponent
See Also:
JComponent.updateUI()

getUI

public CalendarUI getUI()
Returns the look and feel (L&F) object that renders this component.
Returns:
the CalendarUI object that renders this component

setUI

public void setUI(CalendarUI ui)
Sets the look and feel (L&F) object that renders this component.
Parameters:
ui - the CalendarUI L&F object
See Also:
UIDefaults.getUI(javax.swing.JComponent)

getUIClassID

public java.lang.String getUIClassID()
Returns a string that specifies the name of the L&F class that renders this component.
Overrides:
getUIClassID in class javax.swing.JComponent
Returns:
"CalendarUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

getModel

public java.util.Calendar getModel()
Deprecated. replaced by getCalendar()

Returns the model, java.util.Calendar.
Returns:
the calendar model
See Also:
setModel(java.util.Calendar)

setModel

public void setModel(java.util.Calendar cal)
Deprecated. replaced by setCalendar(java.util.Calendar)

Sets the model, java.util.Calendar.
Parameters:
cal - the calendar model
See Also:
getModel()

setCalendar

public void setCalendar(java.util.Calendar cal)
Sets the calendar object used by this JClock.
Parameters:
cal - the calendar object used by this JClock
Since:
JCalendar 1.2
See Also:
getCalendar()

getCalendar

public java.util.Calendar getCalendar()
Returns the calendar object used by this JClock.
Returns:
the calendar object used by this JClock
Since:
JCalendar 1.2
See Also:
setCalendar(java.util.Calendar)

setTime

public void setTime(java.util.Date time)
Sets this Calendar's current time with the given Date.
Parameters:
date - the given Date.
See Also:
getTime()

getTime

public java.util.Date getTime()
Gets this Calendar's current time.
Returns:
the current time.
See Also:
setTime(java.util.Date)

getYear

public int getYear()
Returns this calendar's current year.
Returns:
the year represented by this date
See Also:
Calendar

setYear

public void setYear(int year)
Sets the year of this JCalendar object to be the specified value.
Parameters:
year - the year value.
See Also:
Calendar

getMonth

public int getMonth()
Returns the calendar's current month.
Returns:
the month represented by this date.
See Also:
replaced by Calendar.get(Calendar.MONTH).

setMonth

public void setMonth(int month)
Sets the month of this date to the specified value.
Parameters:
month - the month value between 0-11.
See Also:
replaced by Calendar.set(Calendar.MONTH, int month).

getDate

public int getDate()
Returns the calendar's current date.
Returns:
the day of the month represented by this date.
See Also:
Calendar

setDate

public void setDate(int date)
Sets the day of the month of this JCalendar object to the specified value.
Parameters:
date - the day of the month value between 1-31.
See Also:
Calendar

setCellRenderer

public void setCellRenderer(AbstractCellRenderer cellRenderer)
Sets the cell renderer for render day.
Parameters:
cellRenderer - the cell renderer
Since:
JCalendar 1.3
See Also:
getCellRenderer()

getCellRenderer

public AbstractCellRenderer getCellRenderer()
Returns the cell renderer for render day.
Returns:
the cell renderer
Since:
JCalendar 1.3
See Also:
setCellRenderer(com.zfqjava.swing.cell.AbstractCellRenderer)

setCellProvider

public void setCellProvider(CellProvider cellProvider)
Sets the cell provider for renderer.
Parameters:
cellProvider - the cell provider
Since:
JCalendar 1.3
See Also:
getCellProvider()

getCellProvider

public CellProvider getCellProvider()
Returns the cell provider for renderer.
Returns:
the cell provider
Since:
JCalendar 1.3
See Also:
setCellProvider

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
This method should not invoke by user.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Adds an action listener to the JCalendar.
Parameters:
listener - the listener to add
See Also:
JCalendar()

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener from the JCalendar.
Parameters:
listener - the listener to remove

getActionListeners

public java.awt.event.ActionListener[] getActionListeners()
Returns an array of all the action listeners registered on this JCalendar.
Returns:
all of the JCalendar's ActionListeners or an empty array if no action listeners are currently registered
See Also:
addActionListener(java.awt.event.ActionListener), removeActionListener(java.awt.event.ActionListener)

fireActionPerformed

protected void fireActionPerformed(java.awt.event.ActionEvent e)
Notifies all listeners that have registered interest for notification on this event type.
Parameters:
e - the action event to fire
See Also:
EventListenerList

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to the JCalendar component.

Note: Fires ChangeEvent when month or year or date selection has changed. If only interesting date changed event, attach a PropertyChangeListener and listen date property, about month or year you can use the same style.

Parameters:
l - the listener to add

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener from the JCalendar component.

Note: Fires ChangeEvent when month or year or date selection has changed. If only interesting date changed event, attach a PropertyChangeListener and listen date property, about month or year you can use the same style.

Parameters:
l - the listener to remove

getChangeListeners

public javax.swing.event.ChangeListener[] getChangeListeners()
Returns an array of all the ChangeListeners added to this JCalendar with addChangeListener().

Note: Fires ChangeEvent when month or year or date selection has changed. If only interesting date changed event, attach a PropertyChangeListener and listen date property, about month or year you can use the same style.

Returns:
all of the ChangeListeners added or an empty array if no listeners have been added

fireStateChanged

protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created.
See Also:
EventListenerList

paramString

protected java.lang.String paramString()
Returns a string representation of this JCalendar. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
Overrides:
paramString in class javax.swing.JComponent
Returns:
a string representation of this JCalendar.

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JCalendar. For JCalendars, the AccessibleContext takes the form of an AccessibleJCalendar. A new AccessibleJCalendar instance is created if necessary.
Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class javax.swing.JComponent
Returns:
an AccessibleJCalendar that serves as the AccessibleContext of this JCalendar


Copyright © 2001-2003 Extreme Component, Inc. All rights reserved.