
These are the Basic Steps that you need to run the Bean.


If you are using an IDE ie. Visual Age, JDeveloper, etc.
--------------------------------------------------------
Figure out the way by which you can add a Bean to your Beans pallete
Then add this Bean using DatePicker.jar file
Once its on the  Beans pallete just drag its on your container ie. frame/applet/panel

eg. BDK
1.start Sun's BDK from file menu select -> load jar file 
2.From the file open dialog box select the DatePicker.jar file 
It adds to components panel

3.Select it and place it on the frame.

Thats All



If you are not using an IDE 
------------------------------------------------
1. 

Firstly add DatePicker.jar file in your class path

if it is stored in the directory c:\dtpicker

->Just run DOS and write on the foll command on the dos prompt
	set classpath=c:\jdk1.2.1\lib; c:\jdk1.2.1\bin; . ;c:\dtpicker\DatePicker.jar

Don't miss out the "." in your classpath setting.

The . implies current directory.
(The classpath is similar to the PATH command of DOS it 
shows JAVA the path it should search for classes)



In your .java file :-

2.

import DatePickerBean.*;

3.

Create the DatePicker object.
DatePicker dp=new DatePicker();

4.
Add this object to your Frame or Panel as you normally add any component.
eg. add(dp)

5. Now the next step is how to receive the notification if a date is selected in the DatePicker Calendar.

For that your current class should implement DatePickerListener 

this class contains only method: public void dateChanged(DatePicker DPObj)

This method is invoked every time you select a Date from the Calendar or use one of the 'setDate' Methods.

This DPObj can be used to find the new date selected using DPObj.getDate()



6. 
You can programatically set its current date using setDate() methods


7. 

Now setting the Date Selection Range using Min & Max Date Settings

The default Min date is 1st jan of the previous year &
The default Max date is 31st Dec of the next year.

So if today is sep 20, 2001 than
Mindate:jan 1, 2000
Maxdate:dec 31, 2002

But you can alter these Date using the foll methods:
setMinDate() methods to set minimum date,
setMaxDate() methods to set maximum date and


To make things easy these methods take a variety of parameters. You can pass a Gregorian Calender obj, SQl Date obj, or directly use yyyy,mm,dd in int formats

These can also be set through various constructors.


8.
There are other functions which are related to the calender of this bean.
You set its title, position, various colors, etc.

9.
DatePicker has basic exceptions which are self explanatory
	InvalidDateException, GreaterThanMaxDateException, .LessThanMinDateException

They are all derived from DatePickerException class
They become active when you try to set dates programatically.


10.
Here is a basic sample code: myapp.java

***********************************************************************


import java.awt.*;
import java.awt.event.*;
import DatePickerBean.*;

public class myapp extends Frame implements DatePickerListener
{

	DatePicker dp=new DatePicker();
	public myapp()
	{
		super("DatePickerBean");
		add(dp,BorderLayout.NORTH);
	
		try
		{
			dp.setMinDate(1999,5,12);
			dp.setMaxDate(2010,4,21);
		}
		catch(DatePickerException dpe)
		{}


		// adding a DatePickerListener

		dp.addDatePickerListener(this);
		

		//adding window closing for the frame
		addWindowListener( new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				System.exit(0);
			}
		}
		);


		setSize(400,400);
		setVisible(true);

	}
	public void dateChanged(DatePicker DatePickerObj)
	{
		System.out.print(DatePickerObj.toString());
	}
	
	public static void main(String args[])
	{
		myapp3 m=new myapp3();
	}
}



********************************************************************************


I hope you now understand the basic way to use this Bean. Now if you once again 
go through the Java Docs & the readme's you will understand things better and use this bean to your advantage.


--- PRAMOD S. JAISWAL

