how to set JTextFields dynamically with a JSPinner?

205 Views Asked by At

I want to add an array of JTextFields inside a panel with a JSpinner but I need to repaint the panel every time the spinner's value is changed.

How can I add that 'listener' to the spinner?

1

There are 1 best solutions below

1
On

Start by taking a look at How to Use Spinners and the JavaDocs for JSpinner

You could attach a ChangeListener to the JSpinner using JSpinner#addChangeListener, which provide notifications when the model is updated