Questions tagged [jspinner]

JSpinner is a class in Java's Swing package. It is a single-line input field that lets the user select a number or an object value from an ordered sequence.

From javadoc:

Spinners typically provide a pair of tiny arrow buttons for stepping through the elements of the sequence. The keyboard up/down arrow keys also cycle through the elements. The user may also be allowed to type a (legal) value directly into the spinner. Although combo boxes provide similar functionality, spinners are sometimes preferred because they don't require a drop down list that can obscure important data.

A JSpinner's sequence value is defined by its SpinnerModel. The model can be specified as a constructor argument and changed with the model property. SpinnerModel classes for some common types are provided: SpinnerListModel, SpinnerNumberModel, and SpinnerDateModel.

357 questions
0
votes
0 answers

SpinnerDateModel in JTable

Using several examples from various sources I've developed my take on Spinner based JTable editor. Everything works fine and dandy until I press something in other columns with other types of data. Then table freezes and Console throws…
TheGrandDuke
  • 101
  • 4
0
votes
1 answer

How to reset a JSpinner to min value

I need to reset a JSpinner to its min value. I've tried get it from model: spinner.setValue(((SpinnerNumberModel) spinner.getModel()).getMinimum()); But i've got IllegalArgumentException...
Daniel Silva
  • 316
  • 1
  • 5
  • 10
0
votes
1 answer

binding two JSpinners increment and decrement

i have created two JSpinners with netbeans Form, i want to link the two JSpinners so that if the value of one of them decrements, the value of the other incrementes and vice versa. i tried with this piece of code but it's not working : int…
Sam
  • 17
  • 6
0
votes
1 answer

Issue when using Java Swing in a For-Loop

I have created a simple for-loop that changes the amount of JTextFields and JLabels based on the value of a JSpinner, as seen in the following code: public static ArrayList> ChangeQuestionAnswerFields(int…
0
votes
1 answer

how to set JTextFields dynamically with a JSPinner?

I want to add an array of JTextFields inside a panel with a JSpinner but I need to repaint the panel every time the spinner's value is changed. How can I add that 'listener' to the spinner?
Angel Ruvalcaba
  • 105
  • 1
  • 6
0
votes
1 answer

StackOverFlowError and Values equalling crazy numbers

I have this code: Integer it = (Integer)(strengthSpinner.getValue()); The value of the spinner there is equal to: SpinnerModel one = new SpinnerNumberModel(10, 10, 99, 1); Every time the source is returned as the JSpinner a pointsRemaining--;…
Nick Gibson
  • 155
  • 1
  • 3
  • 10
0
votes
2 answers

How do I know if increment/decrement on JSpinner is pressed?

I have a few JSpinners and they are numeric values starting at 10 and can be incremented until 99. In my program the user has 15 points to disperse evenly across 6 skills. Every JSpinner has an EventListener to detect if its pressed, but more…
Kitsune
  • 49
  • 1
  • 5
0
votes
1 answer

How to change jspinner date min and max values from (database) variables?

Basically this is the problem, I pull some data set from the database, and populate combobox with it. So like you can see in this shoot http://prntscr.com/7bscob. Min and max jspinner values SHOULD depend on comboBox selected item. So what I've…
kiselitza
  • 119
  • 8
0
votes
1 answer

getting value from jSpinner in jOptionPane

I need to put a JSpinner in a JOptionPane. Here is what I've tried: public void actionPerformed(ActionEvent event) { SpinnerNumberModel Model = new SpinnerNumberModel(0.05, 0.00, 1.00, 0.01); JSpinner spinner1 = new JSpinner(Model); int…
Stella
  • 21
  • 4
0
votes
2 answers

Custom JSpinner Model not working

I tried to implement my own JSpinner model to accept an enumeration (including I18N), so I did like that: searchSpinner.setModel(new AbstractSpinnerModel() { int index = 0; int minIndex = 0; int maxIndex = MY_ENUM.values().length - 1; …
Houssam Badri
  • 2,441
  • 3
  • 29
  • 60
0
votes
2 answers

Get the exact jSpinner Value

Can somebody tell me how can I get the exact value from jSpinner? Here is how my jSpinner's appear when user will select time: however, when I pass the jSpinner value to textfield it appears like this: Here is my code: timeout1 =…
nhix
  • 81
  • 3
  • 13
0
votes
1 answer

How do I make a JPanel item go under another item in the same BorderLayout?

I am trying to get my JTextField (desc) to under the JSpinner, (dayspinner) but I'm not sure how. If I put the text field in SOUTH, it just goes all the way to the bottom of the window. I would also like to implement whatever solution there is to…
David L
  • 47
  • 1
  • 7
0
votes
1 answer

Retrieve time from MySQL database & populate JSpinner in Java

How do I retrieve the time format from a MySQL database and use it to populate a JSpinner in Java? The JSpinner should be populated when I click the 'NEXT' button. The code I am currently using is as follows: Calendar calendar =…
yetin
  • 61
  • 11
0
votes
2 answers

How can I disable the textfield area of JSpinner

I'm currently having a problem in netbeans where my JSpinner is allowing you to type in the textfield while I only want the arrows to be used. Is there a way to disable the input of text via properties or some other way? Thanks
Dylan
  • 1
  • 6
0
votes
2 answers

IllegalArgumentException: invalid sequence element when creating SpinnerListModel

I am trying to make a JSpinner with a set of values which step less and less as they decrease, so I created a function to generate these values and I add 100 values to a list, then try to create a SpinnerListModel with the list as it's source. This…
mbdavis
  • 3,861
  • 2
  • 22
  • 42