JSpinner size
843804Feb 8 2005 — edited Feb 8 2005Is there any way to control a JSpinner's size semantically?
Other components seem to have intelligent, nonliteral ways of controlling their sizes;
JList and JComboBox allow a "prototype" value to be set.
JLabels automatically resizes themselves when their contents change.
JComboBox and JList can be set to show a specific number of rows.
JTextField and JTextArea can be set to a certain number of rows and columns.
I like the above ways of managing component sizes, because they don't screw you over if your application is run on a system with a different language, font-set, screen DPI, or whatever. There's nothing worse than having to specify component sizes in pixels.
But JSpinner doesn't seem to support any such methods. I'm using a JSpinner that starts out containing a value of 0; as soon the user spins it to a value with more than one digit, the additional digits are hidden by the edge of the component. Why doesn't JSpinner resize itself, or at least provide a way to set a prototype value or something?