Package PamView

Class PamAWTUtils

java.lang.Object
PamView.PamAWTUtils

public class PamAWTUtils extends Object
Useful functions for swing.
Author:
Jamie Macaulay
  • Constructor Details

    • PamAWTUtils

      public PamAWTUtils()
  • Method Details

    • setPanelEnabled

      public static void setPanelEnabled(JComponent jComponent, Boolean isEnabled)
      Disable an entire swing panel including all child components.
      Parameters:
      jComponent - - the panel to disable
      isEnabled - true if enabled.
    • setMoreEnabled

      public static void setMoreEnabled(Component component)
    • setMoreDisabled

      public static void setMoreDisabled(Component component)
    • findClosestBoundry

      public static Point2D findClosestBoundry(Shape area, Point2D point)
      Find the closest boundary of a shape to a point. http://stackoverflow.com/questions/8103451/point-outside-of-area-which-is-closest-to-point-inside
      Parameters:
      area - - the shape
      point - - the point from which to find the closest the boundary point
      Returns:
      the closest boundary point.
    • colorToInt

      public static int colorToInt(Color c)
      Convert a colour to an int.
      Parameters:
      c - - the colour to change.
      Returns:
      the int representation of the colour
    • intToColor

      public static Color intToColor(int value)
      Convert an int encoded with a colour to a Color object.
      Parameters:
      value - - the int to convert to colour
      Returns:
      the Color object for the int