java - getting date from a Jspinner of SPinnerDateModel -


i creating employee parole system include accepting date of joining.

i using swings create interface in java. want user set value of spinner in date , program must able obtain day month , year selected user.

my employee object consists of variable of class date created me.

i want object of employee created when user clicks submit button.

im unable find solution.

here few snippets of program.

mainframe.java

private jspinner sdoj; private spinnerdatemodel sp; sp=new spinnerdatemodel();  sdoj=new jspinner(sp); submit.addactionlistener(new actionlistener() {  @override public void actionperformed(actionevent arg0) {     employee emp=new employee();      emp.setdoj(sp.getcalendarfield()); //this have tried not successful      } } 

employee.java

public class employee {      private int employeeid;     private string employeename,employeeaddress;     private boolean bc, bcplus,bjava;     private enumgender egender;     private enumdepartment edepartment;     private enumqualification equalification;     private date doj;      public employee() {        // todo auto-generated constructor stub     } } 

date.java

public class date {     private int day,month,year;      public date(int day, int month, int year) {         super();         this.day = day;         this.month = month;         this.year = year;     } } 

i think want:

@override public void actionperformed(actionevent arg0) {     employee emp=new employee();     emp.setdoj(sp.getdate());//changed getdate setdoj accepts date parameter } 

spinnerdatemodel#getdate()

as per docs:

returns current element in sequence of dates. method equivalent (date)getvalue.

nb date object returned not refer own custom date class rather java.util.date


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -