Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSpinner in Swings

 
bolloju bnm
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
In my project i came across a situation like
i have to get the selectedItemindex from JSpinner.
how to get it.please give me the quick reply.
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following Google search command will take you to Sun's Tutorial on JSpinner.

JSpinner Tutorial site:java.sun.com

Kaydell
 
bolloju bnm
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didnot get the correct answer.give me clearly.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
assuming your spinner is set as a SpinnerListModel,
JSpinner spinner = new JSpinner(new SpinnerListModel( [someArray] ));

all you would need is this
System.out.println(java.util.Arrays.asList( [someArray] ).indexOf(spinner.getValue()));
 
bolloju bnm
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you michael
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic