Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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

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: 689
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