Class AwtUtil

java.lang.Object
org.mbari.jcommons.awt.AwtUtil

public class AwtUtil extends Object
  • Constructor Details

    • AwtUtil

      public AwtUtil()
  • Method Details

    • toPoint

      public static Point toPoint(Point2D p2)
      Convert a Point to a Point2D. Decimals are rounded.
      Parameters:
      p2 - The Point2D object to convert
      Returns:
      the Point object closes to the Point2D object
    • toPoint2D

      public static Point2D toPoint2D(Point p)
      Convert a Point2D to a Point.
      Parameters:
      p - The Point object to convert
      Returns:
      the Point2D.Double object containing the infromation from the point you supplied.
    • getWindow

      public static Optional<Window> getWindow(Component component)
      Returns the Window that contains the given component. If it's not contained in window then null is returned.
      Parameters:
      component - The component whose containing window we want to find.
      Returns:
      The containing window or None if not in a containing window
    • getFrame

      public static Optional<Frame> getFrame(Component component)
      Returns the Frame that contains the given component. If it's not contained in a Frame (for example if it's in a Dialog, which is a Window but not a Frame) then None is returned