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

public final class Windows extends Object
A utility class for windows.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    resize(Window window, double screenSizeRatio)
    Resizes the given window so that it is screenSizeRatio percent of the current screen size
    static void
    resize(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
    static Dimension
    screenSizeRatio(double ratio)
     
    static void
    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

    Methods inherited from class java.lang.Object

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

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