Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSpinner size

843804Feb 8 2005 — edited Feb 8 2005
Is 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2005
Added on Feb 8 2005
3 comments
455 views