ListSpinner

Hello,

I am unable to find any samples with spinners for NetBeans. I

have successfully copied Java samples to NetBeans and they

compile and run OK but when I try to incorporate the code into

my own design in NetBeans I cannot get the spinners to work.

I now made the simplest project possible with a JField, a

JSpinner and a JButton.

I want the spinner to display a list of three words, "first",

"second" and "third" but all I get when I run the project is

stuck on the word "first" in the field and the spinner just

cycles through numbers. I want the words to appear in the

spinner window, not the field. The field is there just to test

what is happening/not happening.

public void createEntryFields () {

String[] stateStrings = getStateStrings();

SpinnerListModel listModel = new

SpinnerListModel(stateStrings);

JSpinner stateSpinner = new JSpinner(new

SpinnerListModel(stateStrings));

[1013 byte] By [longbreak] at [2007-11-26 11:53:41]
# 1

This is a wrong forum to ask Swing related questions. This forum is dedicated to web application development using Sun Java Studio Creator.

Anyway, did you take a look at Java Almanac which has lots of examples for swing components. Here are some samples for JSpinner

http://www.exampledepot.com/egs/javax.swing/spinner_Spinner.html

- Winston

http:.//blogs.sun.com/winston

wjprakash at 2007-7-7 12:10:45 > top of Java-index,Development Tools,Java Tools...