This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hello, I am having hard to finding a code to manage to get this arrow listener(up&down) for a JTextField. I've taken a picture to show what I mean(Attachment).
Check out JSpinner. for the first one you will need a SpinnerListModel, for the second one a SpinnerNumberModel. Also check out spinner editors. In short, you can create these two fields like this:
Hello, I took a look at your example. I am still having hard to fitting the JSpinner into this part of the code. What am I missing? The shown example is how the complete look should look like, every part is done except the JSpinner.
1) Your country spinner will not contain the contents of the country array. You need to use this array inside your SpinnerListModel for the country spinner.
2) The years are hard coded this way but again not used. The SpinnerNumberModel has been defined without any parameters so that means its minimum value is Integer.MIN_VALUE, its maximum value is Integer.MAX_VALUE and its current value is 0. Try this:
This will also use the years from 1998 until 2003 with 1998 as the default.
3) You have nowhere added these two spinners to your user interface.
Now before asking any more questions I suggest you really read that link Maneesh has given you. It will probably help you understand how spinners work instead of just copying some example.