I’m working on a i18n application in JAVA.
I’m using JSpinner with a String[] as model to allow user to select some option.
My problem is the text in JSpinner is changing by language.
so I wan’t use index of selected option instead of its value.
How can I get (and set) selected index in a JSpinner?
I’m working on a i18n application in JAVA. I’m using JSpinner with a String[]
Share
You could get the value of the JSpinner, than iterate through it’s data (whatever List you set it to), and find the index of it. To set the index, just get the object at the index you want, and set the object to that. See examples below. You could also make your own SpinnerModel
Searching example: