|
Replies:
13
-
Pages:
1
-
Last Post:
18 Jan 21, 19:11
Last Post By: Laza
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Unusable jSpinner
Posted:
31 Dec 20, 13:53
|
|
|
In Animatics 2.0.2, the jSpinner at Animatics > Lightbox > Main image > Max is unusable.
|
|
|
Posts:
1,895
Registered:
6-Sep-2005
|
|
|
Re: Unusable jSpinner
Posted:
31 Dec 20, 13:56
in response to: JeffTucker
|
|
|
That's odd - it works for me. Perhaps another MacOS quirk?
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Re: Unusable jSpinner
Posted:
31 Dec 20, 14:07
in response to: Laza
|
|
|
|
No, this is on Windows, with System standard look-and-feel. It's a field formatting issue - see screenshot. It's OK in jAlbum Dark, for example.
ETA: The same control is OK in Photoblogger, so whatever you're doing there....
|
|
|
Posts:
1,895
Registered:
6-Sep-2005
|
|
|
Re: Unusable jSpinner
Posted:
31 Dec 20, 15:33
in response to: JeffTucker
|
|
|
Ah, I guess it's only the width, that is the decimals are hidden. I'll fix this foir the next release.
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Re: Unusable jSpinner
Posted:
31 Dec 20, 16:00
in response to: Laza
|
|
|
OK.
I just checked on macOS, and with the System standard look-and-feel, it shows the same problem - the width is too small.
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Re: Unusable jSpinner
Posted:
7 Jan 21, 13:49
in response to: JeffTucker
|
|
|
Still not fixed in Animatics 2.1.
|
|
|
Posts:
1,895
Registered:
6-Sep-2005
|
|
|
Re: Unusable jSpinner
Posted:
7 Jan 21, 15:59
in response to: JeffTucker
|
|
|
Ooops, I forgot about this. Anyway, isn't this the task of Swing? I mean you never give 1 character wide spinner for a float number, where the step is 0.1.
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Re: Unusable jSpinner
Posted:
7 Jan 21, 16:01
in response to: Laza
|
|
|
To repeat, it's formatted correctly in Photoblogger. Why not just copy your own code?
|
|
|
Posts:
1,895
Registered:
6-Sep-2005
|
|
|
Re: Unusable jSpinner
Posted:
7 Jan 21, 16:10
in response to: JeffTucker
|
|
|
This is Photoblogger:
JSpinner maxZoom = new JSpinner(new SpinnerNumberModel(1.4, 1.1, 3.0, 0.1));
... and this is Animatics:
JSpinner maxScale = new JSpinner(new SpinnerNumberModel(1.4, 1.0, 2.0, 0.1));
Now spot the difference why the first looks good and the second not! (No setWidth() or similar is applied)
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Re: Unusable jSpinner
Posted:
7 Jan 21, 16:45
in response to: Laza
|
|
|
Just a guess, but in Animatics, the min and max values are both integers, which is probably fooling the layout control.
I've been down this rabbit hole before, and it's why I don't use non-integer JSpinners. I've run into all sorts of weird behavior with non-integer JSpinners, including some really crazy rounding errors.
For something like this, I would just show the Max value as a percentage (along with an appropriate JLabel):
JSpinner maxScale = new JSpinner(new SpinnerNumberModel(140, 100, 200, 10));
Then I just do a "float divide" in the skin template.
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Re: Unusable jSpinner
Posted:
7 Jan 21, 17:38
in response to: JeffTucker
|
|
|
|
Well, it's a mystery. I have a little test UI, and I just fed it this: JSpinner testSpinner = new JSpinner(new SpinnerNumberModel(1.4, 1.0, 2.0, 0.1));
What I get in the UI is shown in the screenshot. There's no explicit layout being done to it (like a width setting).
|
|
|
Posts:
1,895
Registered:
6-Sep-2005
|
|
|
Re: Unusable jSpinner
Posted:
18 Jan 21, 18:00
in response to: JeffTucker
|
|
|
I've updated the skin, and hopefully the missing digits bug is fixed too. I can't verify though. Here's the "magic" code for the record:
((JSpinner.DefaultEditor)maxScale.getEditor()).getTextField().setColumns(4);
|
|
|
Posts:
8,357
Registered:
31-Jan-2006
|
|
|
Re: Unusable jSpinner
Posted:
18 Jan 21, 18:50
in response to: Laza
|
|
|
Yes, it's displaying properly now. I checked Windows and macOS, and both System standard and jAlbum Dark look-and-feel.
The remaining mystery is why I've never had to use that "magic" code - it always just worked.
|
|
|
Posts:
1,895
Registered:
6-Sep-2005
|
|
|
Re: Unusable jSpinner
Posted:
18 Jan 21, 19:11
in response to: JeffTucker
|
|
|
Swing is like an old lady afflicted with mood swings.
|
|
|
|
Legend
|
|
Forum admins
|
|
Helpful Answer
|
|
Correct Answer
|
|