You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SwingNumberWidget: improve sliders and scroll bars
This fixes the following issues:
* If a slider had a span (max - min) more than Integer.MAX_VALUE, it
would hang at 100% CPU forever, probably due to a Java bug. We work
around this by refusing to add a slider in this case, and logging a
warning to the user about it.
* If a slider had a large min and/or max value, the labels would get
very long and bleed into each other. We work around this by: a)
showing only the min and max labels, without the three intermediate
labels, when the min and/or max label string length is 5 or more;
and b) hiding the labels altogether when the min and/or max label
string length is 10 or more.
* If the number of ticks is large, the slider still tries to paint
them all. So now we only paint the ticks if there are less than 100.
* If a scroll bar has a minimum value of Integer.MIN_VALUE, it does
something special, according to the documentation. So we avoid that
case by bumping up the min by one if that happens.
* If the widget model somehow returns null for min, max or step,
it would throw an NPE (although in practice this does not happen with
DefaultWidgetModel). But still, the code is defensive about that now.
Closes#32.
0 commit comments