Class RangeSliderUtil
- Since:
- 10 Mar 2017
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionstatic JSlider
createRangeSlider
(int imin, int imax) Constructs a range-capable slider instance.static int[]
getSliderRange
(JSlider slider) Returns the range represented by a range-capable slider.static void
setSliderRange
(JSlider slider, int ilo, int ihi) Sets the range represented by a range-capable slider.
-
Method Details
-
createRangeSlider
Constructs a range-capable slider instance. If possible, an instance ofcom.jidesoft.swing.RangeSlider
is returned, but if that fails it falls back to the (uglier, less capable) local variant.JIDE failure can happen in one of (at least?) two ways. First, if the current Look&Feel is not supported by the JIDE component, which doesn't support for example Nimbus(?). Second, if the JIDE class refers to a JRE class that is not present; this appears to happen on OSX Java 10, where a java.lang.ClassNotFoundException is reported for com.sun.java.swing.plaf.windows.WindowsLookAndFeel, which has apparently been withdrawn in that environment. Tweaking the JIDE source to avoid looking for that class, or to fail more gracefully, or upgrading to a later JIDE-OSS version, could probably work to avoid the latter problem. However, there seems to be a lot of UI magic in the JIDE component (probably unavoidable to get full L&F integration), so it's wise to have a fallback.
- Parameters:
imin
- minimum valueimax
- maximum value- Returns:
- range slider
-
getSliderRange
Returns the range represented by a range-capable slider.- Parameters:
slider
- range-capable slider (presumably created by this class)- Returns:
- 2-element (lo,hi) array
-
setSliderRange
Sets the range represented by a range-capable slider.- Parameters:
slider
- range-capable slider (presumably created by this class)ilo
- range lower valueihi
- range upper value
-