Posted By:
Anonymous
Posted On:
Thursday, August 4, 2005 08:30 AM
class DateInputForm extends Form {
private Date currentDate;
private Calendar cal;
private DateField dateField;
public DateInputForm(){
super("Specify Date");
currentDate=new Date();
cal=Calendar.getInstance();
dateField=new DateField("Enter Date: ",DateField.DATE);
dateField.setDate(currentDate);
append(dateField);
addCommand(CMD_TEST);
}
}
that was the form for holding date
now create it's instance upon clicking some command in your main form or display directly the form
put a test command in your form
and simply
//in some other command where f is an instance of your class
create f;
f = new DateInputForm();
f.setCommandListener(this);
and then
if(c==CMD_TEST)
{
Date date=new Date(f.dateField.getDate().getTime());
}
it will work