Package doodlepad
Class Util
java.lang.Object
doodlepad.Util
A class with useful static utility methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleconstrain(double val, double min, double max) Constrain a value to the given range.static intconstrain(int val, int min, int max) Constrain a value to the given range.static voidinvokeAndWait(Runnable methodRef) Invoke a Runnable synchronously on the AWT event dispatchingstatic voidredraw()Force a redraw of all Shapes synchronously on the AWT event dispatching thread.
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
constrain
public static int constrain(int val, int min, int max) Constrain a value to the given range.- Parameters:
val- The value to constrain.min- The minimum possible value.max- The maximum possible value.- Returns:
- The constrained value.
-
constrain
public static double constrain(double val, double min, double max) Constrain a value to the given range.- Parameters:
val- The value to constrain.min- The minimum possible value.max- The maximum possible value.- Returns:
- The constrained value.
-
invokeAndWait
Invoke a Runnable synchronously on the AWT event dispatching- Parameters:
methodRef- Method reference with signature void methodRef()
-
redraw
public static void redraw()Force a redraw of all Shapes synchronously on the AWT event dispatching thread.
-