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

Making a timestamp from date and time

I am taking date input using jdatepicker : UtilDateModel model = new UtilDateModel(); JDatePanelImpl datePanel = new JDatePanelImpl(model); final JDatePickerImpl datePicker = new JDatePickerImpl(datePanel); datePicker.setBounds(200,430,140,40); I…
Prakhar
  • 530
  • 10
  • 24
0
votes
2 answers

creating a subclass of JSpinner error

So I want to create a subclass of JSpinner so that I can hide all the configuration. The problem is when I put this object on JFrame, I get UI not found error. I can't find out what I missed.. public class Time extends JSpinner { public Time()…
user2628641
  • 2,035
  • 4
  • 29
  • 45
0
votes
1 answer

Java Swing customize SpinnerNumberModel

I want to change the SpinnerNumberModel of a JSpinner in a seperate class (e.g. MyNumberSpinner) I use these values: 10(startvalue), 1(minimum), 500(maximum) and 10 (steps). Now I want it to go to the minimum(1) when im <11 and press the down arrow,…
0
votes
1 answer

combine JSpinner with JFormattedTextField

I want to make a customized JSpinner for editing day hours. I want the format to be 1HH:mm:ss a1, I already get this part. I also want to add in some functionalities of JFormattedTextField: setplaceHolderCharacter('_') For example the time is…
user2628641
  • 2,035
  • 4
  • 29
  • 45
0
votes
1 answer

Read spinner input

In order to get the amount of players (required for a game), I implemented a spinner (from 2 to 8). In order to start the game, I need to get the selected item. I made some research and added the following code: int numPlayers = (int)…
GRoutar
  • 1,311
  • 1
  • 15
  • 38
0
votes
1 answer

How copy value from jtextfield into jspinner

I have problem when I want to insert some hex value into JtextField and want to continue increment or decrement this value throw JSpinner. My problem is that my custom JSPinner always start increment value from 0 and I want to increment from exact…
DahakkaSVK
  • 25
  • 4
0
votes
1 answer

JSpinner doesn't show

I really doesn't understand what it's going on with my JSpinner. I instanciated it and then I tried to set it on my JPanel with a setBounds but the only thing I get is this : The little square on the middle is what should be my JSpinner.. My code…
MHogge
  • 5,408
  • 15
  • 61
  • 104
0
votes
4 answers

Reflecting the value of jSpinner on jLabel when key released

My jSpinner does not reflect the value to JLabel when I change the value using keyboard. When I use up down arrows works fine ! When I use keyboard JLabel remains with previous value Here is the code below private void…
user3498019
  • 95
  • 1
  • 2
  • 10
0
votes
2 answers

Java: Using a set of Enum values as a SpinnerListModel

I apologize in advance if this has been asked elsewhere, but I have looked around and I can't seem to find an answer that fits my situation. Some background: I have taken it upon myself to write a sort of "RPG character builder" for the Savage…
amthomas2112
  • 47
  • 1
  • 1
  • 10
0
votes
1 answer

show value JSpinner from JTable

i want to linked JSpinner with JTable. if i want to click a row in JTable, value in JSpinner change with value in that row JTable. I have source code like this : void select(){ try{ int row = TabelKebutuhan.getSelectedRow(); …
user3440030
  • 45
  • 1
  • 8
0
votes
2 answers

Comparing SQL Dates from various components

I have created a Java Swing interface which has 4 components spinner (JXDatePicker) //get only date in this format yyyy-MM-dd spinner_1 (JTimeChooser) //get only time in this format 00-00-00 spinner_2 (JXDatePicker) //get…
QGA
  • 3,114
  • 7
  • 39
  • 62
0
votes
1 answer

Swing change foreground color of BasicArrowButton

In JSpinner class, how would I change the foreground color of two BasicArrowButton(up and down) components? the component.setForeground(<>) doesn't work. Thanks in advance. EDIT private void set_colors(JSpinner spinner){ int n =…
user2889419
0
votes
1 answer

How to use SpinnerDateModel

This is my code for Datespinner //DateOfBirth{ DateOfBirth = new JLabel("Date Of Birth (MM/DD/YYYY): "); DateOfBirth.setBounds(50,490,180,20); jpanel.add(DateOfBirth); Date date1 = new Date(); dobmodel = new…
0
votes
0 answers

Custom JSpinner with hours not limited to 24

Is there a way to create JSpinner in format hhhh:mm, where hours aren't limited to 24? for example would be valid to set: 1024:45 (1024 hours 45 minutes)
Stan
  • 149
  • 1
  • 2
  • 9
0
votes
1 answer

To check time value in JSpinnerand set date in JDateChooser accordingly

I have two Jdatechooser(named as firstdate and lastdate) and Jspinner(named as starttime and endtime) in a gui. The scenario is, 1.if i open gui i will get the current time and set it in endtime and currenttime-1 in starttime(the code is…
user3164187
  • 1,382
  • 3
  • 19
  • 50