- 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 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.static String
getExcelLetterFromNumber(int number)
Return a letter (just like Excel) associated with the number.static Window
getWindow(Object owner)
Will return aWindow
from an object if any can be found.static double
nearest(double less, double value, double more)
Utility function which returns eitherless
ormore
depending on whichvalue
is closer to.
-
-
-
Method Detail
-
getWindow
public static Window getWindow(Object owner) throws IllegalArgumentException
Will return aWindow
from an object if any can be found.null
value 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 eitherless
ormore
depending on whichvalue
is closer to. Ifvalue
is perfectly between them, then either may be returned.
-
-