Package doodlepad
Class Util
java.lang.Object
doodlepad.Util
A class with useful static utility methods.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
constrain
(double val, double min, double max) Constrain a value to the given range.static int
constrain
(int val, int min, int max) Constrain a value to the given range.static void
invokeAndWait
(Runnable methodRef) Invoke a Runnable synchronously on the AWT event dispatchingstatic void
redraw()
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.
-