- java.lang.Object
-
- org.controlsfx.tools.Utils
-
public class Utils extends Object
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleclamp(double min, double value, double max)Simple utility function which clamps the given value to be strictly between the min and max values.static StringgetExcelLetterFromNumber(int number)Return a letter (just like Excel) associated with the number.static WindowgetWindow(Object owner)Will return aWindowfrom an object if any can be found.static doublenearest(double less, double value, double more)Utility function which returns eitherlessormoredepending on whichvalueis closer to.
-
-
-
Method Detail
-
getWindow
public static Window getWindow(Object owner) throws IllegalArgumentException
Will return aWindowfrom an object if any can be found.nullvalue can be given, the program will then try to find the focused window among those available.- Parameters:
owner- the object whose window is to be found.- Returns:
- the window of the given object.
- Throws:
IllegalArgumentException
-
getExcelLetterFromNumber
public static final String getExcelLetterFromNumber(int number)
Return a letter (just like Excel) associated with the number. When the number is under 26, a simple letter is returned. When the number is superior, concatenated letters are returned. For example: 0 -> A 1 -> B 26 -> AA 32 -> AG 45 -> AT- Parameters:
number- the number whose Excel Letter is to be found.- Returns:
- a letter (like) associated with the number.
-
clamp
public static double clamp(double min, double value, double max)Simple utility function which clamps the given value to be strictly between the min and max values.
-
nearest
public static double nearest(double less, double value, double more)Utility function which returns eitherlessormoredepending on whichvalueis closer to. Ifvalueis perfectly between them, then either may be returned.
-
-