Package doodlepad

Class Util

java.lang.Object
doodlepad.Util

public class Util extends Object
A class with useful static utility methods.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static 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
    Invoke a Runnable synchronously on the AWT event dispatching
    static void
    Force a redraw of all Shapes synchronously on the AWT event dispatching thread.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static void invokeAndWait(Runnable methodRef)
      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.