Class Windows

java.lang.Object
is.codion.swing.common.ui.Windows

public final class Windows extends Object
A utility class for windows, dialogs and frames.
  • Method Details

    • screenSizeRatio

      public static Dimension screenSizeRatio(double ratio)
      Parameters:
      ratio - a ratio, 0.0 - 1.0
      Returns:
      a Dimension which is the size of the available screen times ratio
      Throws:
      IllegalArgumentException - in case ratio is not between 0 and 1
    • setSizeWithinScreenBounds

      public static void setSizeWithinScreenBounds(Window window)
      Resizes the given window so that if fits within the current screen bounds, if the window already fits then calling this method has no effect
      Parameters:
      window - the window to resize
    • resizeWindow

      public static void resizeWindow(Window window, double screenSizeRatio)
      Resizes the given window so that it is screenSizeRatio percent of the current screen size
      Parameters:
      window - the window to resize
      screenSizeRatio - the screen size ratio
      Throws:
      IllegalArgumentException - in case ratio is not between 0 and 1
    • resizeWindow

      public static void resizeWindow(Window window, double screenSizeRatio, Dimension minimumSize, Dimension maximumSize)
      Resizes the given window so that it is screenSizeRatio percent of the current screen size, within the given minimum and maximum sizes
      Parameters:
      window - the window to resize
      screenSizeRatio - the screen size ratio
      minimumSize - the minimum size, may be null
      maximumSize - the maximum size, may be null
      Throws:
      IllegalArgumentException - in case ratio is not between 0 and 1
    • frame

      public static Windows.FrameBuilder frame(JComponent component)
      Parameters:
      component - the component to display in the frame
      Returns:
      a frame builder