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
1 answer

JSpinner in array

I have array JSpinners, but I can´t listening. This one no working, because Java want final variable. When I change spin4[j] to spin4[0] <- it is working. But i need array with JSpinners. Help please. spin4[j].addChangeListener( …
0
votes
1 answer

Getting the value from a jSpinner

I would not have throught this would be such a big problem, but im trying to get the value from a jSpinner called spinHours that is using the default SpinnerNumberModel. spinHours.getValue().toString(); The above always returns 0. I need is as a…
Daniel Jørgensen
  • 1,183
  • 2
  • 19
  • 42
0
votes
0 answers

Prompt before user changes JSpinner

I want to make a JSpinner and when you change it, it will prompt you, "Are you sure you want to change this?" All I can find is the ChangeListener and that only gets run when you change it. I want the spinner to not change until they click "yes" in…
0
votes
0 answers

Validating two JSpinners

I have two JSpinners in one GUI: JSpinner spinner1 = new JSpinner(model1); // To select start date JSpinner spinner2 = new JSpinner(model); // to select end date How can I ensure that the end date is greater than the start date? for example: Start…
Freddy
  • 683
  • 4
  • 35
  • 114
0
votes
1 answer

Setting JSpinner for countdown timer

I want to use a JSpinner to select a time for a countdown timer where the user selects the HR,MIN,SEC where any of these values can be 00. I was using the SpinnerDateModel but the HR cannot be set to 00
user3922757
  • 305
  • 2
  • 5
  • 14
0
votes
0 answers

Jspinner inside Jtable?

I have a Jtable with two columns, first column is a JTextField and the second column is a JSpinner.. While I am using tab key to navigate from JTextField to JSpinner, the JTextField inside the Jspinner is not editable and it is not responding for…
Vishwa Dany
  • 327
  • 2
  • 16
0
votes
3 answers

How to properly set time to JSpinner in Java?

I want to set my JSpinner in Neatbeans swing with the current time, and allow user to choose time through clicking the arrows up and down. I have these code which somehow works at first but cannot change the time when clicking the arrows. Here's my…
Jerson Calinawan
  • 47
  • 1
  • 2
  • 8
0
votes
1 answer

List of numbers component on Swing

I want to show the same as the input type number of HTML5 but on Swing. This image illustrate what I want to do: and the number is going from 0 to 999 for example How can I make the same using Java Swing?
Souad
  • 4,856
  • 15
  • 80
  • 140
0
votes
1 answer

How to modify this view using GridBagLayout

I would be grateful if you could help me to modify this interface. I just started learning GridBagLayout and I want to figure out how I can implement the drawn interface using GridBagLayout() |-----------------------------------------------| |…
QGA
  • 3,114
  • 7
  • 39
  • 62
0
votes
1 answer

Unparseable date exception Creating a date from two objects

i'm using JXDatePicker and JSpinner to input date and time from the user. I then need to format it back to one date in a long millisecond format. with input of 03/09/2014 in JXDatePicker , the output from the JXDatePicker is: Wed Sep 03 00:00:00…
David Gidony
  • 1,243
  • 3
  • 16
  • 31
0
votes
1 answer

for spinner how to detect whether the change is made by button clicked or key pressed?

There are 2 ways to change a spinner's value, either by clicking the up or down button, or by pressing the up or down key. If I know spinner's value is changed, how do I know whether it is caused by button clicking or key pressing?
user2628641
  • 2,035
  • 4
  • 29
  • 45
0
votes
1 answer

Updating jLabel based on jSpinner

Right now I have a jFrame Spinner that just has numbers. I am storing the value of the spinner like this int value = (Integer) jSpinner1.getValue(); And am then outputting it to a jLabel like this jLabel5.setText("Counter = " + value ); I…
Jonah
  • 1,013
  • 15
  • 25
0
votes
0 answers

JSpinner focus issue

I'm on a Mac OS X using the default Look&Feel. I have created a JSpinner and set some attributes on its associated TextField (alignment, color, non-editable). The spinner works properly; it has the focus, but it doesn't show that it has the focus.…
San Lewy
  • 136
  • 1
  • 3
  • 13
0
votes
1 answer

JSpinner disallow user to type into it

How can I make a JSpinner that doesn't allow manual typing into it. I want my spinner to only have even numbers so I made it increment by twos. The the problem becomes that a user can type say a 3 and now your numbers are 3, 5, 7, 9 all of which are…
0
votes
1 answer

How to set format of JSpinner DateEditor?

How to set the format for date Editor of JSpinner? I don't want to set the format in the constructor, I want to set the format later.
user2628641
  • 2,035
  • 4
  • 29
  • 45