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
42
votes
7 answers

JSpinner Value change Events

How to make the update immediately when the jSpinner value was changed. ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent e) { jLabel.setText(e.getSource()); …
user236501
  • 8,538
  • 24
  • 85
  • 119
33
votes
4 answers

How to limit JSpinner

The valid range for this application is 0 to 9 but there seems to be no NetBeans 7.0.1 JSpinner minimum or maximum value setting. Is there another way to limit the range of this JSpinner to 0..9?
jacknad
  • 13,483
  • 40
  • 124
  • 194
18
votes
3 answers

How to get int value from spinner

I'm using NetBeans 7.1 to code in Java. I have a JFrame where I have spinner with integer values on it, I want to know how to get the active value in the spinner, I mean, the one that the user picks when the program is running; to use it on another…
Johnny Dahdah
  • 995
  • 5
  • 15
  • 21
18
votes
4 answers

jQuery whole HTML page load with spinner

I am trying to something simple -- make a jQuery script that will wait to show the entire page, including all DIVs, text, and images. While the page is loading, instead of showing parts of the page I would like to show a spinning GIF image, and when…
user1317510
  • 207
  • 1
  • 2
  • 7
17
votes
3 answers

How to set JSpinner as non editable?

I am creating time picker using a JSpinner. The text inside the JSpinner is editable. But I want to set the JSpinner as non editable, because there is the chance to give an invalid value. Can anyone help me?
Arivu2020
  • 2,485
  • 7
  • 25
  • 24
16
votes
6 answers

How to rendering fraction in Swing JComponents

Basically Swing JComponents are able to display numbers in fractions in this form 2 2/3. How can I paint fraction in the nicest form, for example 2⅔? . EDIT . as see I have only one way JTable inside JSpinner with one TableColumn and TableRow (that…
mKorbel
  • 109,525
  • 20
  • 134
  • 319
16
votes
2 answers

Setting Time Format for jspinner in swings

I am working in a java swing application. In that application i have to take time input from user. I need to make a JSpinner for the time, only in the hh:mm am/pm format. i searched in properties but could not get this format. Please suggest me some…
Toman
  • 1,156
  • 1
  • 12
  • 29
10
votes
1 answer

Make JSpinner completely numeric

I've a Jspinner that can vary from minimum to maximum at steps of 0.1. This is working perfectly fine. Now, I set the editor of JSpinner as NumberEditor as the user can edit the textbox and I want only numeric values from this. This is also working,…
Balanivash
  • 6,709
  • 9
  • 32
  • 48
9
votes
1 answer

Disabling digit grouping in a JSpinner

I needed a widget to select a TCP/UDP port, so I wrote the following: public static JSpinner makePortSpinner() { final JSpinner spinner = new JSpinner( new SpinnerNumberModel( DefaultPort, 1024, 65535, 1 ) ); spinner.setFont(…
9
votes
2 answers

Change JSpinner Size (width)

My problem: JSpinner is so skinny that I can only see the chars on the string in the last spot. ex: "Hello" I only see 'o'. I have a JPanel in a JFrame's BorderLayout.SOUTH The JPanel's layout manager is the default which is - correct me if I'm…
UTSAstudent
  • 111
  • 1
  • 2
  • 3
9
votes
2 answers

Make JSpinner Select Text When Focused

I would like to change the behavior of a JSpinner so that when you click on the text, it selects it. This makes it easier to replace the field with the value that you want. Unfortunately, I can't get the behavior to work and instead, it just inserts…
Thunderforge
  • 19,637
  • 18
  • 83
  • 130
9
votes
3 answers

Finding the cursor text position in JTextField

Is there a method to return the position of the character in the JTextField. What I mean by that is if I have a JTextField with some values in it. For example, the field contains value ABCDEFJ. The user decides to put the cursor right after…
tadpole
  • 1,209
  • 7
  • 19
  • 28
8
votes
3 answers

Difference in JComboBox and JSpinner

I'm writing a Java Desktop utility in Java swing and have a minimal GUI part in it, most of work is done on server side i.e. backend. So, I don't want to spend a lot of time on GUI part, learning different controls and widgets. The problem is that…
moCap
  • 969
  • 1
  • 14
  • 31
7
votes
2 answers

How to check if value was set manually and not with setValue (JSlider, JSpinner)?

How can I check if the value of a JSlider or JSpinner was set via the graphical interface and not via the method setValue( int n) ?
andreihondrari
  • 5,743
  • 5
  • 30
  • 59
6
votes
1 answer

how can I get the value of a the selected item in a JSpinner?

I'm making an application that uses a JSpinner with a max number 30,I should choose a value from this JSpinner and tape a String to the JTextField and the result will appear in the Textarea,when I compile I have many problems concerning the method…
hanem
  • 101
  • 1
  • 2
  • 7
1
2 3
23 24