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: Notification whether input is valid or not

I have a JSpinner with a NumberModel. The Spinner's text field allows arbitrary inputs but only accepts numerical input on commitEdit. This means, if I enter a number followed by any alphabetic characters and press enter then the formatter tries to…
PAX
  • 1,056
  • 15
  • 33
0
votes
1 answer

How can I make a JSpinner object have its entire contents highlighted so that user input does not require deleting when focus is gained?

Not much to add to the Title question. Here's what tabbing to the first box looks like, with cursor before the first character in the field, so that the user will have to delete the character if he wishes to enter his own month, day, or year…
DSlomer64
  • 4,234
  • 4
  • 53
  • 88
0
votes
2 answers

Jpinner setModel not allowing to change value

Am using a spinner for selecting time and facing the below issue, StarttimeSpinner = new JSpinner(); Date time = new SimpleDateFormat("HHmmss", Locale.ENGLISH).parse("000000"); SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); String…
user3164187
  • 1,382
  • 3
  • 19
  • 50
0
votes
1 answer

How can I inform a user that the value he's entered has been constrained to the JSpinner lower bound?

I need to display an error message and NOT change value of a spinner if user types a value outside of the bounds. If the spinner buttons are used there is no issue. But if user types a number lower than lower bound, the spinner automatically sets it…
ManInMoon
  • 6,795
  • 15
  • 70
  • 133
0
votes
2 answers

Changing date in JSpinner

I have created a JSpinner and linked a SpinnerDateModel to it like this. travelTimeModel = new SpinnerDateModel(); travelTimeModel.setCalendarField(Calendar.MINUTE); spinnerTravelTime = new JSpinner(); …
Cyberlurk
  • 766
  • 3
  • 9
  • 30
0
votes
1 answer

Unable to disable editing for a DateEditor's JTextField?

I've been using the below technique to disable editing for JSpinners in the past. It doesn't seem to work with the JTextField in a DateEditor, however. Is there a reason that this editor.getTextField().setEditable(false) doesn't work in this…
asteri
  • 11,402
  • 13
  • 60
  • 84
0
votes
1 answer

How to set predefined time in jspinner

I have some pre defined time in mysql database in varchar format for example - 16:45, 00:30, 09:15, 20:50 and 10 more. I want to display any one of these time in jspinner I am trying but getting error this my jspinner setup where I am displaying the…
user2747954
  • 97
  • 1
  • 5
  • 16
0
votes
2 answers

how to get date value from Jspinner excluding time

i have a Jspinner which shows current date("yyyy//mm//dd" in this format) and i want to get only current date not time,when i use System.out.println(Spinner.getvalue()).It also shows time like this(Mon Sep 09 02:47:53 IST 2013).i just want current…
sam
  • 69
  • 2
  • 5
  • 12
0
votes
1 answer

How to get only year, month,day,horus and seconds from Java JSpinner

I am working on my MySQL project and I have one problem. I have made one JSpinner that shows current date and time. Now I want to save that date and time in one datetime variable for later use, but problem is when I save value from JSpinner into my…
Mahir Duraković
  • 135
  • 1
  • 23
0
votes
1 answer

Java editing batch file ECHO command

I've created a java GUI that executes batch files in order to easily and seamlessly command a serial com port device. try { Process p = Runtime.getRuntime().exec("toggleLed.bat"); } catch(Exception e) { e.printStackTrace(); } This…
Dragongeek
  • 263
  • 1
  • 5
  • 23
0
votes
0 answers

JSpinner.DateEditor 24h

I have a JSpinner with a DateEditor, HH:mm looking like this: Is it possible to make this show both 24:00 and 00:00. Basically I would like it to go like: 23:58, 23:59, 24:00, 00:00, 00:01, 00:02 instead of 23:58, 23:59, 00:00, 00:01, 00:02 I…
Grains
  • 950
  • 3
  • 16
  • 35
0
votes
0 answers

InplaceEditor does not save property when focus lost

I have a little Netbeans App with an custom InplaceEditor integrated in a PropertySheet. When creating the editor, I followed this tutorial: http://netbeans.dzone.com/nb-custom-float-propertyeditor. I'm not posting code because it's basically the…
Chris
  • 489
  • 5
  • 15
0
votes
1 answer

Need jSpinner to be enabled from jRadioButton

I am working in a JTabbedPane inside of a JFrame. I have a jRadioButton that I need when selected to activate/enable two jSpinner controls that select date & time. I cannot find a reference for how this should be completed and this is not a school…
user2497501
0
votes
1 answer

JSpinner value change listener

I have a JSpinner with ChangeListener directed. But the ChangeListener is only activated when I press enter or click on one of the JSpinner buttons. I would like to know how to enable ChangeListener when the value is changed.
0
votes
2 answers

Change the look of the JSpinner arrow buttons

I would like to change the look of the JSpinner arrow buttons so that theses buttons have no border. Is it possible to get a reference on theses buttons to simply call a setBorder() on them, instead of write a spinner UI only for that purpose?
paranoia25
  • 626
  • 1
  • 5
  • 23