• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem on spinner

 
swarna latha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

In our code,first the spinner should be empty.when we click on spinner up arrow or down arrow then only that should show current date.

I have written following code with that ,if i open the screen that is showing the current date with that format.

Date d= new Date();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
SpinnerDateModel model=new SpinnerDateModel(d,null, null, 0);
JSpinner s1 = new JSpinner(model);
JSpinner.DateEditor de = new JSpinner.DateEditor(s1, sdf.toPattern());
s1.setEditor(de);

with the above code i am not able to get empty spinner at first time
so i have written like that to get empty spinner
((JSpinner.DefaultEditor)s1.getEditor()).getTextField().setText("");

If i written that line i am getting empty spinner.Next if i click spinner arrows i should get current date .But i am not able to get.

Please if any one know about this.
please help me to how can i get use action for that.
I have taken changelistener also its not be help ful for me.

Thanks and Regards
K.SwarnaLatha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic