Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help: how to use tab to move from hours section to minutes section in format 'hours:minutes'.

 
Keshav Khedkar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am stuck with a problem regarding jspinner.
I am using jspinner in following code:
Date date = new Date();
SpinnerDateModel sm = new SpinnerDateModel(date, null, null, Calendar.HOUR_OF_DAY);
jsTime = new JSpinner(sm);
JSpinner.DateEditor de = new JSpinner.DateEditor(jsTime, "hh:mm");
jsTime.setEditor(de);
jsTime.getEditor().setEnabled(false);
currently If I press tab key on the above jspinner, focus get shifted to next control (not in above code). What I want is if I am in hours section and presses a tab key then it should go to minutes section. If I am in minutes section and presses a tab key, it should go to next control.
Till now I tried to get as much information as possible from net. but failed to get a solution to this.
Please help me with this.
thanks & regards,
KK.
 
Campbell Ritchie
Sheriff
Posts: 48407
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use the code button, otherwise your post is illegible.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is one of the ways
(needs tweaking if shift-tab is to be exact opposite i.e. comp-->minutes-->hours-->comp)

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic