Right at the start I would like to mention that yes, there already is a question from another user asking basically the same. However that thread does not really have an answer which solves the problem and since the thread is already about seven years old, I suspect I might not get an answer if I would ask in that one.
So the Problem is, that a JSpinner does not show anything unless the Frame on which it is displayed is resized. I have looked at the oracle page "how to use JSpinners", I have looked at a seperate tutorial site and I have tried the solutions people in the other thread have mentioned. None of them have worked for me. So here is the code, help would be greatly appreciated.
package pack;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
public class Test extends JFrame{
private static final long serialVersionUID = 1L;
JSpinner spinner;
public Test() {
setVisible(true);
setSize(500, 500);
setContentPane(new JLabel());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SpinnerNumberModel model = new SpinnerNumberModel(1, 0, 2, 1);
spinner = new JSpinner(model);
spinner.setVisible(true);
spinner.setSize(100,100);
add(spinner);
repaint();
}
public static void main(String[] args) {new Test();}
}