Closed ctrueden closed 1 year ago
This issue has been mentioned on Image.sc Forum. There might be relevant details there:
https://forum.image.sc/t/missing-spinner-buttons-with-flatlaf-look-and-feel/72185/2
Following lines cause the problem:
spinner.getSize()
always returns 0, 0
because the spinner was just created and is not yet layouted.
So the preferred height of the spinner becomes 0
, which FlatLaf does not like.
Probably a bug in FlatLaf. Will investigate...
Anyway seems that the intention of the above code is to limit the preferred width of the spinner.
Replacing spinner.getSize()
with spinner.getPreferredSize()
should fix the issue.
Thanks for the suggestion, @DevCharly. I can confirm this fixes the issue, and opened #78.
FYI, I actually don't think (I could be, of course, wrong - I did not test any other L&F) limiting the preferred width of the spinner is needed. Things seem to work fine if one leaves it to defaults. Maybe this is just some historic code that has been carried over!? On #79, I have a couple of proposals on things that I found when looking into this.
FYI, I actually don't think (I could be, of course, wrong - I did not test any other L&F) limiting the preferred width of the spinner is needed. Things seem to work fine if one leaves it to defaults
I was wrong of course. The rationale for this is explained here: https://github.com/scijava/scijava-ui-swing/pull/79#issuecomment-1264787285
As reported on the Image.sc Forum:
To reproduce:
BigInteger
andBigDecimal
parameters (there's currently a bug affecting them)