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
3 answers

JSpinner getting null value

I want to take null values when my JSpinner is empty. But it returns 0.0 when I call getValue() function. public JFormattedTextField getTextField(JSpinner spinner) { JComponent editor = spinner.getEditor(); if (editor instanceof…
user2279774
  • 53
  • 1
  • 7
0
votes
1 answer

HOWTO Select JSpinner date field when JSpinner gets focus

I am trying to make a JSpinner (containing a minute/second timer) work for a bunch of set-in-their-ways folks who don't care beans about the mouse but want every keystroke to do exactly what they are used to. It works almost as I'd like it to but…
Steve Cohen
  • 4,679
  • 9
  • 51
  • 89
0
votes
1 answer

Jspinner and JOptionPane

How should I amend this code in order to compile? I know there is a lot of problems...Thanks a lot~ What should I put in statechanged? How should I link the JSpinner to JOptionPane?(the btnEnter I created, I added ChangeListener, then what to…
0
votes
1 answer

Does each JSpinner object have its own Model object?

I understand the MVC framework somewhat, but this one thing confuses me a little. So if I have a JComponent such as a JList or a JSpinner, then they have models to store their data. Then does each instance(object) of JList or JSpinner have its own…
sarora
  • 499
  • 5
  • 20
0
votes
1 answer

How to set a date and time to JSpinner in JAVA (Netbeans)?

I have a date and time value in String type. String dateTime = "2012-10-27 19:00:00.000"; And I have a JSpinner named spnDateTime with Spinner Model Type as Date. What I need to do is get the String variable's value and set to the spinner's date…
Dishon Michael
  • 157
  • 1
  • 2
  • 6
0
votes
2 answers

How to specify a range of valid values in a Java GUI

I am creating an IMDB application which displays and organizes movies found on you computer (by looking up the metadata via an IMDB API). In my search panel I want to give the user the option of looking for movies that were released in a specific…
Héctor van den Boorn
  • 1,218
  • 13
  • 32
0
votes
1 answer

text from JSpinner to JTextArea

How can I transfer text from a JSpinner to a JTextArea? I thought about .getText(); but it's not working. dobDate = new JSpinner(new SpinnerDateModel(today, null, null,Calendar.MONTH)); dateEdit = new JSpinner.DateEditor(dobDate,…
Denis Nurasy
  • 41
  • 1
  • 8
0
votes
2 answers

JSpinner Source?

I have a class with two JSpinner objects in them, x and y. I have one change Listener which is added to both. can someone tell me how I can implement my change listener so that the listener can tell the difference between the two objects. e.g.…
andrew Patterson
  • 559
  • 2
  • 6
  • 19
0
votes
1 answer

JSpinner does not transfer focus when pressing Enter

The code bellow was supposed to transfer the focus to the next control after hitting the Enter key at anytime, the event fires but .transferFocus is not transfering the focus, what could be wrong? Thank you //JSpinner Creation Code: private…
paul-2011
  • 675
  • 10
  • 27
0
votes
1 answer

JSpinner sometimes not displaying properly

My problem is that the JSpinner (named spinnerCantidadPuntas in the code) is sometimes not showing at all, or just buggy. when i run the project (F6) its almost guaranteed to not show properly, when i debug it (CTRL+F5) it displays properly most of…
J. Miguel
  • 15
  • 4
0
votes
2 answers

Preventing negative values in jSpinner

I am using netbeans to build gui application in java. It has a jSpinner. I set its minimum value to 0. When i run and click on the down arrow button, i am getting, negativearraysizeexception. Any solution to this? //This code is autogenerated in…
AGEM
  • 217
  • 2
  • 5
  • 12
0
votes
4 answers

how to validate JSpinner textField in java for minimum and maximum value set?

I have two JSpinner one is for minimum and another one for maximum value set. I just want that if min is set some value then user can not enter less than minimum text field value in JSpinner of maximum text field and vice versa. How can I validate…
manav
  • 119
  • 1
  • 2
  • 9
0
votes
1 answer

Create a custom exception for a JSpinner

I have two JSpinner components for which I've created a custom exception and it was working very well. Yesterday I modify the spinner in Netbeans, I added a spinner model editor because I wanted only positive numbers. So now I have only positive…
Pan24112012
  • 307
  • 2
  • 5
  • 10
0
votes
1 answer

Java JSpinner painting twice

Quick picture to show what is happening The JSpinner is appearing twice as seen in the picture above. The first appearance at point (0,0) that should not be there is not selectable, editable or useable with no spinner buttons. The odd thing here is…
Quinma
  • 1,436
  • 2
  • 17
  • 39
0
votes
1 answer

Java Swing - I have a requirement to convert enter number to minutes and seconds in HH:MM format

In Java Swing, do we have text component that will work just like how we set the time in Microwave. By default system should display 00:00:00 (hh:mm:ss) in a textfield. Users focus defaults in the far right of the text box in the far right…
user1430989
  • 525
  • 2
  • 6
  • 15