>>I made a JSpinner with the height of a JTextField with the default font.
>>The spin buttons don't size down correctly,
[quoted text clipped - 4 lines]
> both more productive, *and* less painful..
> <http://www.physci.org/codes/sscce.jsp>
>> <http://www.physci.org/codes/sscce.jsp>
..
> There's always the possibility that someone already knows the problem,
Very true (and noted in the document), but
it does help get people's interest and help..
> but here it is:
Well.. no. Did you actually try compiling that?
I *went* to do so, but the moment came when I
went to save it as it's class name and..
After making a few 'tweaks I came up with this
(that actually does compile).
<sscce>
import java.awt.BorderLayout;
import javax.swing.*;
import javax.swing.border.*;
public class SpinnerHeightTest {
public static void main(String[] avs)
{
JSpinner oSpinner = new JSpinner();
oSpinner.setBorder(new TitledBorder("Spinner"));
JPanel oPanel = new JPanel();
oPanel.setLayout(new BorderLayout());
oPanel.add(oSpinner,BorderLayout.NORTH);
JFrame oFrame = new JFrame();
oFrame.setContentPane(oPanel);
// oFrame.show(); //deprecated in 1.5
oFrame.setVisible(true);
// always a good idea
oFrame.pack();
}
}
</sscce>
Before the call to pack() the UI was only
the title bar, after, I did not observe the
behaviour you described. Using WinXp and
Java 1.5.0 beta, the JSpinner seemed the size
I would expect of a JTextField.
(shrugs) Back to you.

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Steven T Abell - 08 Sep 2004 23:02 GMT
> Did you actually try compiling that?
I copied it out of the file in which I wrote it.
Within the class defined there, it does compile and run.
> Before the call to pack() the UI was only
> the title bar, after, I did not observe the
[quoted text clipped - 3 lines]
>
> (shrugs) Back to you.
I'm using XP and 1.4.2.
I dug deeper into the bug database, found something similar.
In 1.4.2, JSpinner's sizing machinery doesn't account for borders.
I've treated the problem by embedding the spinner in a panel,
then putting the border on the panel.