com.esri.map.popup
Class JCalendar
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.esri.map.popup.JCalendar
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
public class JCalendar
- extends JPanel
This class displays a calendar control containing the year, month and days in the month. The year can be incremented
and decremented with buttons or set by typing in the box. Similarly the month can be incremented and decremented or
selected from a drop down list. The current day in the calendar used to create this control is highlighted and a new
date can be selected by clicking a day in the calendar. The calendar modified by selecting new combinations of year,
month and day can be retrieved by calling getCalendar()
. An ActionListener
can be added to this
control that will be notified whenever the date is changed by selecting a new year, month or day. The year and month
can be changed programatically by calling stepYear(boolean)
and stepMonth(boolean)
- See Also:
- Serialized Form
Constructor Summary |
JCalendar(Calendar calendar)
Create a new calendar control displaying the date in the given calendar. |
Method Summary |
void |
addActionListener(ActionListener listener)
Adds an action listener. |
protected void |
fireCalendarChanged()
Fire calendar changed. |
Calendar |
getCalendar()
Gets a copy of the calendar used to set up this control but with the currently selected year, month and day set. |
protected void |
initDaysOfWeek()
Initialise the days of week. |
protected void |
initDaysTable()
Set up the days table and add a listener for its selection events. |
protected void |
initGui()
Initialise the gui by setting the controls to display the date of the calendar currently set in the control. |
protected void |
initMonth()
Display the current month in the correct order in the drop down list. |
protected void |
initYear()
Display the current year. |
static void |
main(String[] args)
Launch the application. |
void |
removeActionListener(ActionListener listener)
Removes the action listener. |
void |
setBackground(Color bg)
|
void |
setCalendar(Calendar calendar)
|
void |
stepMonth(boolean stepUp)
Increment or decrement the month. |
void |
stepYear(boolean stepUp)
Increment or decrement the year. |
protected void |
update()
Update the year, month and day controls to match the current calendar settings. |
Methods inherited from class javax.swing.JComponent |
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, 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 |
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, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
_selectedRow
protected int _selectedRow
_selectedColumn
protected int _selectedColumn
JCalendar
public JCalendar(Calendar calendar)
- Create a new calendar control displaying the date in the given calendar.
- Parameters:
calendar
- the calendar
main
public static void main(String[] args)
- Launch the application.
- Parameters:
args
- the arguments
getCalendar
public Calendar getCalendar()
- Gets a copy of the calendar used to set up this control but with the currently selected year, month and day set.
- Returns:
- a copy of the calendar for the selected date
setCalendar
public void setCalendar(Calendar calendar)
setBackground
public void setBackground(Color bg)
- Overrides:
setBackground
in class JComponent
stepYear
public void stepYear(boolean stepUp)
- Increment or decrement the year. Year, months and days will be update as appropriate.
- Parameters:
stepUp
- true to increment year, false to decrement it
stepMonth
public void stepMonth(boolean stepUp)
- Increment or decrement the month. Year, months and days will be update as appropriate.
- Parameters:
stepUp
- true to increment month, false to decrement it
addActionListener
public void addActionListener(ActionListener listener)
- Adds an action listener. This will be notified each time a new date is selected.
- Parameters:
listener
- the listener
removeActionListener
public void removeActionListener(ActionListener listener)
- Removes the action listener.
- Parameters:
listener
- the listener
initGui
protected void initGui()
- Initialise the gui by setting the controls to display the date of the calendar currently set in the control.
initDaysTable
protected void initDaysTable()
- Set up the days table and add a listener for its selection events.
initYear
protected void initYear()
- Display the current year.
initMonth
protected void initMonth()
- Display the current month in the correct order in the drop down list.
initDaysOfWeek
protected void initDaysOfWeek()
- Initialise the days of week. This determines the first day of the week and creates the table headings with the day
names in the correct order.
update
protected void update()
- Update the year, month and day controls to match the current calendar settings.
fireCalendarChanged
protected void fireCalendarChanged()
- Fire calendar changed.
Copyright © 2012. All Rights Reserved.