org.gui
Class JCalendarCombo

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.gui.JCalendarCombo
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.util.Observer, java.io.Serializable

public class JCalendarCombo
extends javax.swing.JPanel
implements java.util.Observer

This is the main class of the JCalendarCombo Library.

Version:
1.4
Author:
Arpit Agarwal
See Also:
Serialized Form

Field Summary
static int DAY
           
static int MONDAY
           
static int MONTH
           
static int SUNDAY
           
static int YEAR_BIG
           
static int YEAR_SMALL
           
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
JCalendarCombo()
          This constructor variation of JCalendarCombo initializes the default implementation of the Calendar widget and set start year as 1901 and end year as 2099.
JCalendarCombo(boolean isApplet)
          This constructor variation of JCalendarCombo initializes the user implementation of the Calendar widget and set start year as 1901 and end year as 2099.
JCalendarCombo(int firstDay, boolean showCurrentDate, boolean isApplet)
          This constructor variation of JCalendarCombo initializes the user implementation of the Calendar widget and set start year as 1901 and end year as 2099.
JCalendarCombo(int firstDay, boolean showCurrentDate, int startYear, int endYear, boolean isApplet)
          This constructor variation of JCalendarCombo initializes the user implementation of the Calendar widget and set start year as 1901 and end year as 2099.
 
Method Summary
 java.util.Calendar getDate()
          This method may be used to get the selected date.
 boolean getEnabled()
          This method may be used to get whether JCalendarCombo is enabled or disabled.
 java.lang.String getSelectedDate()
          This method may be used to get the selected date.
 java.lang.String getSelectedDay()
          This method may be used to get the selected day.
 java.lang.String getSelectedMonth()
          This method may be used to get the selected month.
 java.lang.String getSelectedYear()
          This method may be used to get the selected year.
 void setDate(java.util.Calendar temp)
          This method may be used to set the selected date in the current widget to a specified date.
 void setDateFormat(int tempVar1, int tempVar2, int tempVar3, char separatorChar)
          This method may be used to set the date format.
 void setEnabled(boolean isEnabled)
          This method may be used to enable or disable JCalendarCombo.
 void setSelectedDate(int year, int month, int day)
          This method may be used to set the selected date in the current widget to a specified date.
 void update(java.util.Observable observable, java.lang.Object object)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DAY

public static final int DAY
See Also:
Constant Field Values

MONDAY

public static final int MONDAY
See Also:
Constant Field Values

MONTH

public static final int MONTH
See Also:
Constant Field Values

SUNDAY

public static final int SUNDAY
See Also:
Constant Field Values

YEAR_BIG

public static final int YEAR_BIG
See Also:
Constant Field Values

YEAR_SMALL

public static final int YEAR_SMALL
See Also:
Constant Field Values
Constructor Detail

JCalendarCombo

public JCalendarCombo()
This constructor variation of JCalendarCombo initializes the default implementation of the Calendar widget and set start year as 1901 and end year as 2099. This constructor does not work on applets.


JCalendarCombo

public JCalendarCombo(boolean isApplet)
This constructor variation of JCalendarCombo initializes the user implementation of the Calendar widget and set start year as 1901 and end year as 2099. This constructor is applet compatible.

Parameters:
isApplet - Set it true if you are going to use the calendar on applet.

JCalendarCombo

public JCalendarCombo(int firstDay,
                      boolean showCurrentDate,
                      boolean isApplet)
This constructor variation of JCalendarCombo initializes the user implementation of the Calendar widget and set start year as 1901 and end year as 2099. This constructor is applet compatible. It may also be used to customize the implementation according to your needs. You may specify and set the first day of week as either Sunday or Monday. You also have a choice to highlight the current date.

Parameters:
firstDay - set it to JCalendarCombo.SUNDAY or JCalendarCombo.MONDAY.
showCurrentDate - set it to true to show the current date.
isApplet - set it true if you are going to use the calendar on applet.

JCalendarCombo

public JCalendarCombo(int firstDay,
                      boolean showCurrentDate,
                      int startYear,
                      int endYear,
                      boolean isApplet)
This constructor variation of JCalendarCombo initializes the user implementation of the Calendar widget and set start year as 1901 and end year as 2099. This constructor is applet compatible. It may also be used to customize the implementation according to your needs. You may specify and set the first day of week as either Sunday or Monday. You also have a choice to highlight the current date.

Parameters:
firstDay - set it to JCalendarCombo.SUNDAY or JCalendarCombo.MONDAY.
showCurrentDate - set it to true to show the current date.
startYear - set the start year value
endYear - set the end year value.
isApplet - set it true if you are going to use the calendar on applet.
Method Detail

getDate

public final java.util.Calendar getDate()
This method may be used to get the selected date.

Returns:
new Calendar Object

getEnabled

public final boolean getEnabled()
This method may be used to get whether JCalendarCombo is enabled or disabled.

Returns:
isEnabled true if enabled or false if disabled.

getSelectedDate

public final java.lang.String getSelectedDate()
This method may be used to get the selected date.

Returns:
selectedDate

getSelectedDay

public final java.lang.String getSelectedDay()
This method may be used to get the selected day.

Returns:
selectedDay

getSelectedMonth

public final java.lang.String getSelectedMonth()
This method may be used to get the selected month.

Returns:
selectedMonth

getSelectedYear

public final java.lang.String getSelectedYear()
This method may be used to get the selected year.

Returns:
selectedYear

setDate

public final void setDate(java.util.Calendar temp)
This method may be used to set the selected date in the current widget to a specified date.

Parameters:
temp - set the selected date based on Calendar Object.

setDateFormat

public final void setDateFormat(int tempVar1,
                                int tempVar2,
                                int tempVar3,
                                char separatorChar)
This method may be used to set the date format.

Parameters:
tempVar1 - set it to either JCalendarCombo.DAY, JCalendarCombo.MONTH, JCalendarCombo.YEAR_BIG or JCalendarCombo.SMALL.
tempVar2 - set it to either JCalendarCombo.DAY, JCalendarCombo.MONTH, JCalendarCombo.YEAR_BIG or JCalendarCombo.SMALL.
tempVar3 - set it to either JCalendarCombo.DAY, JCalendarCombo.MONTH, JCalendarCombo.YEAR_BIG or JCalendarCombo.SMALL.
separatorChar - set the separator character in between the date vales.

setEnabled

public final void setEnabled(boolean isEnabled)
This method may be used to enable or disable JCalendarCombo.

Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
isEnabled - true to enable or false to disable

setSelectedDate

public final void setSelectedDate(int year,
                                  int month,
                                  int day)
This method may be used to set the selected date in the current widget to a specified date.

Parameters:
year - set the year of the selected date.
month - set the month of the selected date.
day - set the day of the selected date.

update

public void update(java.util.Observable observable,
                   java.lang.Object object)
Specified by:
update in interface java.util.Observer