This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 13 - Pages: 1 - Last Post: 18 Jan 21, 19:11 Last Post By: Laza
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Unusable jSpinner
Posted: 31 Dec 20, 13:53
 
  Click to reply to this thread Reply
In Animatics 2.0.2, the jSpinner at Animatics > Lightbox > Main image > Max is unusable.
Laza

Posts: 1,908
Registered: 6-Sep-2005
Re: Unusable jSpinner
Posted: 31 Dec 20, 13:56   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
That's odd - it works for me. Perhaps another MacOS quirk?
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Re: Unusable jSpinner
Posted: 31 Dec 20, 14:07   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Attachment ss008161.png (13.9 KB)
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.... ;)
Laza

Posts: 1,908
Registered: 6-Sep-2005
Re: Unusable jSpinner
Posted: 31 Dec 20, 15:33   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Ah, I guess it's only the width, that is the decimals are hidden. I'll fix this foir the next release.
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Re: Unusable jSpinner
Posted: 31 Dec 20, 16:00   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
OK.

I just checked on macOS, and with the System standard look-and-feel, it shows the same problem - the width is too small.
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Re: Unusable jSpinner
Posted: 7 Jan 21, 13:49   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Still not fixed in Animatics 2.1.
Laza

Posts: 1,908
Registered: 6-Sep-2005
Re: Unusable jSpinner
Posted: 7 Jan 21, 15:59   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
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.
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Re: Unusable jSpinner
Posted: 7 Jan 21, 16:01   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
To repeat, it's formatted correctly in Photoblogger. Why not just copy your own code?
Laza

Posts: 1,908
Registered: 6-Sep-2005
Re: Unusable jSpinner
Posted: 7 Jan 21, 16:10   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
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)
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Re: Unusable jSpinner
Posted: 7 Jan 21, 16:45   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
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.
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Re: Unusable jSpinner
Posted: 7 Jan 21, 17:38   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Attachment ss008167.png (1.1 KB)
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).
Laza

Posts: 1,908
Registered: 6-Sep-2005
Re: Unusable jSpinner
Posted: 18 Jan 21, 18:00   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
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);
JeffTucker

Posts: 8,377
Registered: 31-Jan-2006
Re: Unusable jSpinner
Posted: 18 Jan 21, 18:50   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
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.
Laza

Posts: 1,908
Registered: 6-Sep-2005
Re: Unusable jSpinner
Posted: 18 Jan 21, 19:11   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Swing is like an old lady afflicted with mood swings.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums