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

Insert jspinner time value to database

I have two jspinners. the one contains an HH:mm format and the other one is a simple number(int) spinner. when SAVE button clicked I want to update a database table that contains the timeLimit (type time) and attempts (type int) columns. But I dont…
Kent Abrio
  • 445
  • 2
  • 9
  • 27
0
votes
1 answer

How to change date using mouse scroll in JSpinner?

I have this code below; what I want is, how can I change date using mouse? Hoping someone can help. JSpinner dateStart = new JSpinner(); Date dateNow = Calendar.getInstance().getTime(); dateStart.addMouseWheelListener(new…
Rhye
  • 15
  • 7
0
votes
2 answers

MouseWheelListener in JSpinner JAVA

Please see my code below.. What i want is during my mouse wheel event it would scroll to a list set in my spinnermodel but unable to do it. can you help me what is appropriate code on mousewheel event? JSpinner lines = new JSpinner(); …
Rhye
  • 15
  • 7
0
votes
1 answer

How to use the changed value of a SpinnerDateModel in a Timer to perform a task?

I want to take the difference between the changed value and the curent date of the spinnerdatemodel as the delay for the timer. This is the JSpinner: Calendar cal = Calendar.getInstance(); cal.add(Calendar.YEAR, 5); Date max =…
M. MaRiuS
  • 1
  • 2
0
votes
1 answer

Add a string following the value in a JSpinner

Is it possible to add a character or a String after the value in a JSpinner (something like "xxx€", "xxx months", xxx being the value) ?
IKSDEY
  • 5
  • 3
0
votes
1 answer

How to compare Date objects ignoring seconds and milliseconds?

I am trying to compare Date objects in Java but when I test it, it fails because (I think) of seconds and milliseconds. Date date = (Date) jSpinner.getValue(); Date now = Calendar.getInstance().getTime(); if(date.before(now)) …
kuranes
  • 546
  • 1
  • 6
  • 16
0
votes
1 answer

How to undo changes on JSpinner?

I need to validate the user input of a JSpinner, and if invalid, I need to undo (rollback) the value change. What is the best way to do it?
michelemarcon
  • 23,277
  • 17
  • 52
  • 68
0
votes
1 answer

Changing JSlider value to JSpinner value and vice versa on change

I have a JSlider object named quantitySl and a JSpinner object named quantitySp. When someone changes the spinner I want to change the slider to the same value and vice versa. The initialization of the objects is as follows: SpinnerNumberModel…
Higeath
  • 541
  • 5
  • 20
0
votes
1 answer

JSpinner Number editor

What does this below piece of code actually does, //Make the year be formatted without a thousands separator. spinner.setEditor(new JSpinner.NumberEditor(spinner, "#")); Why this is required for eliminating the comma in JSpinner…
user3164187
  • 1,382
  • 3
  • 19
  • 50
0
votes
0 answers

How can i add an event to JSpinner if its value has been increased in GUI?

I use GUI and I want to add an event in my jSpinner if its value has been increased, i tried all events in the proprieties for example mouseClicked(MouseEvent) but no one of them works, How can i add this event? private void…
Reem Aljunaid
  • 109
  • 1
  • 9
0
votes
0 answers

Calculate Difference between 2 Dates with a JSpinner

after testing for hours and looking through the internet, I haven't found help for my problem... Ok to my problem: I have two JSpinner, that show the current Hour and Minutes. They look like that: Date date = new Date(); SpinnerDateModel sm = new…
Felicce
  • 25
  • 1
  • 1
  • 6
0
votes
1 answer

How to horizontally center JSpinner

I searched the site and couldn't find what I'm looking for. I tried the setAlignmentX(JSpinner.CENTER_ALIGNMENT) method of JSpinner, and also tried to set the preferred width to 10, but it did not work. I want JSpinners horizontally centered at…
f.mike
  • 5
  • 2
0
votes
0 answers

Swing Spinner Column

I have a class that I use for creating JSpinner box based column in a JTable. However, I have an issue that when I edit values in new row the old value of the spinner box is shown in the new cell. For example, if I made value in row 1 to be 3, and…
Kapil Sharma
  • 1,412
  • 1
  • 15
  • 19
0
votes
1 answer

How can I use general string in Jspinner?

I have problem with JSpinner over to show Month in JSpinner and i have follow code bellow.I use swing control with jframe form to use spinner control. When I run project it always set default value 0. How to solve this error? static protected…
nara son
  • 39
  • 5
0
votes
1 answer

How to set the floating point symbol in JSpinner to dot instead of comma if the locale is french?

I am making a Java application localized in French. I used some JSpinners that accept only a float. The problem is that the decimal point (the separator between integer part and decimal part) in float numbers is represented by a comma (,). This…
Hamza Abbad
  • 564
  • 3
  • 15