DatePickerBean
Class DatePicker

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Button
              |
              +--DatePickerBean.DatePicker
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable


public class DatePicker
extends java.awt.Button

See Also:
Serialized Form

Field Summary
static int dd_mm_yyyy
           
static int dd_mmm_yyyy
           
static int dd_mmmm_yyyy
           
static int ldow_dd_mmm_yyyy
           
static int ldow_dd_mmmm_yyyy
           
static int ldow_mmm_dd_yyyy
           
static int ldow_mmmm_dd_yyyy
           
static int mm_dd_yyyy
           
static int mmm_dd_yyyy
           
static int mmmm_dd_yyyy
           
static int sdow_dd_mmm_yyyy
           
static int sdow_dd_mmmm_yyyy
           
static int sdow_mmm_dd_yyyy
          Default Date Format
static int sdow_mmmm_dd_yyyy
           
static int LANG_ENGLISH
           
static int LANG_FRENCH
           
static int LANG_FINNISH
           
 
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
Default Date is Today.
Default Min Date is 'Previous years 1st January' and
Default Max Date is 'Next years 31st December'

           
DatePicker()
           
DatePicker(java.sql.Date date)
           
DatePicker(java.sql.Date date, java.sql.Date mindate, java.sql.Date maxdate)
           
DatePicker(java.util.GregorianCalendar date)
           
DatePicker(java.util.GregorianCalendar date, java.util.GregorianCalendar mindate, java.util.GregorianCalendar maxdate)
           
DatePicker(int yyyy, int mm, int dd)
           
 
Method Summary
 int addDatePickerListener(DatePickerListener dpl)
           
 void autoResizeDPButton(boolean flag)
          If set to true the DatePickerButton will be automatically resized according to the
current the length of the text ( date representation ) on the button
 boolean autoResizeDPButton()
          
static int CompareDates(java.util.GregorianCalendar date1, java.util.GregorianCalendar date2)
          Returns -1 if date1 < date2
Returns 0 if date1 = date2
Returns +1 if date1 > date2
This method ignores the Time Factor while comparing
static int CompareDates(int dy1, int dm1, int dd1, int dy2, int dm2, int dd2)
          Returns -1 if date1 < date2
Returns 0 if date1 = date2
Returns +1 if date1 > date2
This method ignores the Time Factor while comparing
 void enableDateSelection(boolean flag)
          Enable/Disable date selection using this method. Although the user will be able to view the Calendar but he/she wont be able to change the Date.
 java.awt.Color getArrowColor()
           
 boolean getAutoCalendarPosition()
           
 java.awt.Color getCalendarArrowColor()
           
 java.awt.Color getCalendarBackground()
           
 java.awt.Color getCalendarDaysColor()
           
 int getCalendarHeight()
           
 boolean getCalendar_Modal()
          Specifies the existing Modality of the DatePicker Calendar.
 java.awt.Color getCalendarSelectionColor()
           
 java.lang.String getCalendarTitle()
           
 java.awt.Color getCalendarWeekdaysColor()
           
 java.awt.Color getCalendarMonthColor()
           
 java.awt.Color getCalendarMouseOverYear_Color()
           
 java.awt.Color getCalendarYearColor()
           
 int getCalendarWidth()
           
 java.util.GregorianCalendar getDate()
          Returns the Currently Selected Date.
 int getDateFormat()
           
 DatePicker getDateValues()
           
 int getDay()
           
 int getDayFrom(java.util.GregorianCalendar date)
           
 static int getDaysBetween(java.util.GregorianCalendar date1,java.util.GregorianCalendar date2)
           
 java.lang.String getDOW(java.util.GregorianCalendar date)
          Returns the Day Of Week in String Format for the given GregorianCalendar Object.
eg."Sunday".
boolean getEditableYearVisible()
          
 java.lang.String getFormattedDate()
          this method returns the current date in the current format of your datepicker object..
 java.lang.String getFormattedDate(java.util.GregorianCalendar dt, int dtformat)
          Returns a Date in String Format for the given GregorianCalendar Object with the specified Date Format Constant.
String str=yourDatePickerObj.getFormattedDate(new GregorianCalendar(),DatePicker.dd_mm_yyyy);
str will contain "31/12/2000".
 java.util.GregorianCalendar getMaxDate()
           
 java.util.GregorianCalendar getMinDate()
           
 int getMonth()
           
 int getMonthFrom(java.util.GregorianCalendar date)
           
 java.lang.String getMonthStr(java.util.GregorianCalendar date)
          Returns the Month in String Format for the given GregorianCalendar Object.
eg."January".
 static int getNumberOfDaysInYear(int year)
 boolean getShowDateRangeInCalendar()
           
 boolean getShowTodayInCalendar()
           
 int getYear()
           
 int getYearFrom(java.util.GregorianCalendar date)
           
 void inApplet(boolean flag)
          Use this method only if you are placing the DatePicker Object in an Applet.
 boolean inApplet()
          Returns true if DatePicker is in placed in an applet.
 void inBrowser(boolean flag)
          Provided for backward compatibility.
May be deprecated in future.
 boolean inBrowser()
          Provided for backward compatibility.
May be deprecated in future.
 void paint(java.awt.Graphics g)
           
 int removeDatePickerListener(DatePickerListener dpl)
           
 void setArrowColor(java.awt.Color color)
           
 void setAutoCalendarPosition(boolean flag)
          if flag is true then Calendar Window is automatically positioned w.r.t the DatePicker.
if flag is false then Calendar Window is centered.
 void setCalendarArrowColor(java.awt.Color color)
           
 void setCalendarBackground(java.awt.Color color)
           
 void setCalendarDaysColor(java.awt.Color color)
           
 void setCalendarOwner(Dialog dlg)
           
 void setCalendarOwner(Frame f)
           
 void setCalendarSelectionColor(java.awt.Color color)
           
 void setCalendarTitle(java.lang.String title)
           
 void setCalendarWeekdaysColor(java.awt.Color color)
           
 void setCalendarMonthColor(java.awt.Color color)
           
 void setCalendarMouseOverYear_Color(java.awt.Color color)
           
 void setCalendarYearColor(java.awt.Color color)
           
 void setCalendar_Modal(boolean flag)
           
 void setDate(java.sql.Date date)
           
 void setDate(java.util.GregorianCalendar date)
           
 void setDate(int yyyy, int mm, int dd)
           
 void setDateFormat(int dateformat)
          Sets the Date Format to as specified in .
Use one of the above formats.
eg.
 void setDateValues(DatePicker dp)
          Sets the Date, Minimum Date and Maximum date of your DatePicker Object with the specified DatePicker Object's Date, MinDate and MaxDate respectively.
 void setDateValues(int cury, int curm, int curd, int miny, int minm, int mind, int maxy, int maxm, int maxd)
          Please Do not use this method.
This method will be used by your IDE to Generate JAVA Code.

Use setDateValues(DatePicker dp) instead.
This method Will be Deprecated in future versions.
 void setEditableYearVisible(boolean flag)
           
 void setMaxDate(java.sql.Date date)
           
 void setMaxDate(java.util.GregorianCalendar date)
           
 void setMaxDate(int yyyy, int mm, int dd)
           
 void setMinDate(java.sql.Date date)
           
 void setMinDate(java.util.GregorianCalendar date)
           
 void setMinDate(int yyyy, int mm, int dd)
           
 void showCalendar()
           
 void showCalendar(int xpos,int ypos)
           
 void showDateRangeInCalendar(boolean flag)
           
 void showTodayInCalendar(boolean flag)
           
 java.lang.String toString()
           
 
Methods inherited from class java.awt.Button
addActionListener, addNotify, getAccessibleContext, getActionCommand, getLabel, getListeners, removeActionListener, setActionCommand, setLabel
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dd_mm_yyyy

public static final int dd_mm_yyyy

mm_dd_yyyy

public static final int mm_dd_yyyy

dd_mmm_yyyy

public static final int dd_mmm_yyyy

dd_mmmm_yyyy

public static final int dd_mmmm_yyyy

mmm_dd_yyyy

public static final int mmm_dd_yyyy

mmmm_dd_yyyy

public static final int mmmm_dd_yyyy

ldow_dd_mmm_yyyy

public static final int ldow_dd_mmm_yyyy

ldow_dd_mmmm_yyyy

public static final int ldow_dd_mmmm_yyyy

ldow_mmm_dd_yyyy

public static final int ldow_mmm_dd_yyyy

ldow_mmmm_dd_yyyy

public static final int ldow_mmmm_dd_yyyy

sdow_dd_mmm_yyyy

public static final int sdow_dd_mmm_yyyy

sdow_dd_mmmm_yyyy

public static final int sdow_dd_mmmm_yyyy

sdow_mmm_dd_yyyy

public static final int sdow_mmm_dd_yyyy
Default Date Format

sdow_mmmm_dd_yyyy

public static final int sdow_mmmm_dd_yyyy

LANG_ENGLISH

public static final int LANG_ENGLISH
Default Language Setting

LANG_FRENCH

public static final int LANG_FRENCH

LANG_FINNISH

public static final int LANG_FINNISH

Constructor Detail

DatePicker

public DatePicker()

DatePicker

public DatePicker(java.sql.Date date)
           throws DatePickerException

DatePicker

public DatePicker(java.util.GregorianCalendar date)
           throws DatePickerException

DatePicker

public DatePicker(int yyyy,
                  int mm,
                  int dd)
           throws DatePickerException

DatePicker

public DatePicker(java.sql.Date date,
                  java.sql.Date mindate,
                  java.sql.Date maxdate)
           throws DatePickerException

DatePicker

public DatePicker(java.util.GregorianCalendar date,
                  java.util.GregorianCalendar mindate,
                  java.util.GregorianCalendar maxdate)
           throws DatePickerException
Method Detail

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Component

setCalendarTitle

public void setCalendarTitle(java.lang.String title)

getCalendarTitle

public java.lang.String getCalendarTitle()

setArrowColor

public void setArrowColor(java.awt.Color color)

getArrowColor

public java.awt.Color getArrowColor()

setCalendarBackground

public void setCalendarBackground(java.awt.Color color)

getCalendarBackground

public java.awt.Color getCalendarBackground()

setCalendarArrowColor

public void setCalendarArrowColor(java.awt.Color color)

getCalendarArrowColor

public java.awt.Color getCalendarArrowColor()

setCalendarWeekdaysColor

public void setCalendarWeekdaysColor(java.awt.Color color)

setCalendar_Modal

public void setCalendar_Modal(boolean flag)
Specifiy the Modality of the Calendar Window

getCalendar_Modal

public boolean getCalendar_Modal()
Specifies the existing Modality of the DatePicker Calendar.

getCalendarWeekdaysColor

public java.awt.Color getCalendarWeekdaysColor()

setCalendarDaysColor

public void setCalendarDaysColor(java.awt.Color color)

getCalendarDaysColor

public java.awt.Color getCalendarDaysColor()

setCalendarMonthColor

public void setCalendarMonthColor(java.awt.Color color)

getCalendarMonthColor

public java.awt.Color getCalendarMonthColor()

setCalendarYearColor

public void setCalendarYearColor(java.awt.Color color)

getCalendarYearColor

public java.awt.Color getCalendarYearColor()

setCalendarMouseOverYear_Color

public void setCalendarMouseOverYear_Color(java.awt.Color color)

getCalendarMouseOverYear_Color

public java.awt.Color getCalendarMouseOverYear_Color()

setCalendarOwner

public void setCalendarOwner(Dialog dlg)
The DatePicker Calendar is a Dialog & it has its own intrenal frame by default.
You can supply your own Existing Dialog-Reference to it. This will make the Calendar the child of your Dialog.
If the Dialog passed is already the owner of the the Calendar than no change is made.

setCalendarOwner

public void setCalendarOwner(Frame f)
The DatePicker Calendar is a Dialog & it has its own intrenal frame by default.
You can supply your own Existing Frame-Reference to it. This will make the Calendar the child of your Frame.
If the frame passed is already the owner of the the Calendar than no change is made.

getCalendarHeight

public int getCalendarHeight()
Gets the Height of the DatePicker Calendar

getCalendarWidth

public int getCalendarWidth()
Gets the Width of the DatePicker Calendar

setCalendarSelectionColor

public void setCalendarSelectionColor(java.awt.Color color)

getCalendarSelectionColor

public java.awt.Color getCalendarSelectionColor()

setDateFormat

public void setDateFormat(int dateformat)
Sets the Date Format to as specified in .
Use one of the above formats.
eg. yourDatePickerObj.setDateFormat(DatePicker.ldow_mmm_dd_yyyy);

setAutoCalendarPosition

public void setAutoCalendarPosition(boolean flag)
if flag is true then Calendar Window is automatically positioned w.r.t the DatePicker.
if flag is false then Calendar Window is centered.

getAutoCalendarPosition

public boolean getAutoCalendarPosition()

setDate

public void setDate(java.sql.Date date)
             throws DatePickerException
Check if the DatePickerException is an instance of
GreaterThanMaxDateException or
LessThanMinDateException.

setDate

public void setDate(java.util.GregorianCalendar date)
             throws DatePickerException
Check if the DatePickerException is an instance of
GreaterThanMaxDateException or
LessThanMinDateException.

setDate

public void setDate(int yyyy,
                    int mm,
                    int dd)
             throws DatePickerException
Check if the DatePickerException is an instance of
InvalidDateException,
GreaterThanMaxDateException or
LessThanMinDateException.

setMinDate

public void setMinDate(java.sql.Date date)
                throws GreaterThanMaxDateException

setMinDate

public void setMinDate(int yyyy,
                       int mm,
                       int dd)
                throws DatePickerException
Check if the DatePickerException is an instance of
InvalidDateException or GreaterThanMaxDateException.

setMinDate

public void setMinDate(java.util.GregorianCalendar date)
                throws GreaterThanMaxDateException

setMaxDate

public void setMaxDate(java.sql.Date date)
                throws LessThanMinDateException

setMaxDate

public void setMaxDate(int yyyy,
                       int mm,
                       int dd)
                throws DatePickerException
Check if the DatePickerException is an instance of
InvalidDateException or LessThanMinDateException

setMaxDate

public void setMaxDate(java.util.GregorianCalendar date)
                throws LessThanMinDateException

addDatePickerListener

public int addDatePickerListener(DatePickerListener dpl)

removeDatePickerListener

public int removeDatePickerListener(DatePickerListener dpl)

autoResizeDPButton

public void autoResizeDPButton(boolean flag)
If set to true the DatePickerButton will be automatically resized according to the current the
length of the text ( date representation ) on the button.

autoResizeDPButton

public boolean autoResizeDPButton()

showCalendar

public void showCalendar()
Explicitly Displays the DatePicker Calendar without the Clicking of the DatePicker Button
If the DatePicker is not visible than the calendar is screen centered else the AutoCalendarPosition takes effect.

showCalendar

public void showCalendar(int xpos,int ypos)
Explicitly Displays the DatePicker Calendar without the Clicking of the DatePicker Button on the specific position

showCalendar

public void showDateRangeInCalendar(boolean)
Help you to Show/Hide DATE RANGE in the Calendar.
Has an effect the Height of the Calendar.

showCalendar

public void showTodayInCalendar(boolean flag)
Help you to Show/Hide TODAY in the Calendar.
Has an effect the Height of the Calendar.

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

getDateFormat

public int getDateFormat()

getDate

public java.util.GregorianCalendar getDate()
Returns the Currently Selected Date.

getShowDateRangeInCalendar

public boolean getShowDateRangeInCalendar()

getShowTodayInCalendar

public boolean getShowTodayInCalendar()

getYear

public int getYear()

getMonth

public int getMonth()

getDay

public int getDay()

getMinDate

public java.util.GregorianCalendar getMinDate()

getMaxDate

public java.util.GregorianCalendar getMaxDate()

getYearFrom

public int getYearFrom(java.util.GregorianCalendar date)

getMonthFrom

public int getMonthFrom(java.util.GregorianCalendar date)

getDayFrom

public int getDayFrom(java.util.GregorianCalendar date)

getDaysBetween

public static int getDaysBetween(java.util.GregorianCalendar date1,java.util.GregorianCalendar date2)
Returns the number of days between the Two Dates.

getMonthStr

public java.lang.String getMonthStr(java.util.GregorianCalendar date)
Returns the Month in String Format for the given GregorianCalendar Object.
eg."January".

getNumberOfDaysInYear

public satic int getNumberOfDaysInYear(int year)

getDOW

public java.lang.String getDOW(java.util.GregorianCalendar date)
Returns the Day Of Week in String Format for the given GregorianCalendar Object.
eg."Sunday".

setEditableYearVisible

void  setEditableYearVisible(boolean flag)

getEditableYearVisible

boolean getEditableYearVisible()

getFormattedDate

public java.lang.String getFormattedDate()
This method returns the current date in the current format of your datepicker object.

getFormattedDate

public java.lang.String getFormattedDate(java.util.GregorianCalendar dt,
                                         int dtformat)
Returns a Date in String Format for the given GregorianCalendar Object with the specified Date Format Constant.
String str=yourDatePickerObj.getFormattedDate(new GregorianCalendar(),DatePicker.dd_mm_yyyy);
str will contain "31/12/2000".

setDateValues

public void setDateValues(DatePicker dp)
Sets the Date, Minimum Date and Maximum date of your DatePicker Object with the specified DatePicker Object's Date, MinDate and MaxDate respectively.

setDateValues

public void setDateValues(int cury,
                          int curm,
                          int curd,
                          int miny,
                          int minm,
                          int mind,
                          int maxy,
                          int maxm,
                          int maxd)
Please Do not use this method.
This method will be used by your IDE to Generate JAVA Code.

Use setDateValues(DatePicker dp) instead.
This method Will be Deprecated in future versions.

getDateValues

public DatePicker getDateValues()

inApplet

public void inApplet(boolean flag)
Use this method only if you are placing the DatePicker Object in an Applet. Adjusts the height of the Calendar to negate the effect of Warning: Applet Window

inApplet

public boolean inApplet()
Returns true if DatePicker is in placed in an applet.

inBrowser

public void inBrowser(boolean flag)
By Default this value is set to false.

Provided for backward compatibility.
May be deprecated in future.

inBrowser

public boolean inBrowser()
Provided for backward compatibility.
May be deprecated in future.

CompareDates

public static int CompareDates(java.util.GregorianCalendar date1,
                               java.util.GregorianCalendar date2)
Returns -1 if date1 < date2
Returns 0 if date1 = date2
Returns +1 if date1 > date2
This method ignores the Time Factor while comparing

CompareDates

public static int CompareDates(int dy1,
                               int dm1,
                               int dd1,
                               int dy2,
                               int dm2,
                               int dd2)
Returns -1 if date1 < date2
Returns 0 if date1 = date2
Returns +1 if date1 > date2
This method ignores the Time Factor while comparing

enableDateSelection

public void enableDateSelection(boolean flag)
Enable/Disable date selection using this method. Although the user will be able to view the Calendar but he/she wont be able to change the Date.