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

public final class Windows extends Object
A utility class for windows.
  • 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
    • resizeToFitScreen

      public static void resizeToFitScreen(Window window)
      Resizes the given window so that if fits within its screen bounds.

      if the window already fits or has no graphics configuration then calling this method has no effect

      Parameters:
      window - the window to resize
    • resize

      public static void resize(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
    • resize

      public static void resize(Window window, double screenSizeRatio, @Nullable Dimension minimumSize, @Nullable 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