java.lang.Object
is.codion.swing.common.ui.window.Windows
A utility class for windows.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Resizes the given window so that it isscreenSizeRatio
percent of the current screen sizestatic void
Resizes the given window so that it isscreenSizeRatio
percent of the current screen size, within the given minimum and maximum sizesstatic Dimension
screenSizeRatio
(double ratio) 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
-
Method Details
-
screenSizeRatio
- 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
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
Resizes the given window so that it isscreenSizeRatio
percent of the current screen size- Parameters:
window
- the window to resizescreenSizeRatio
- 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 isscreenSizeRatio
percent of the current screen size, within the given minimum and maximum sizes- Parameters:
window
- the window to resizescreenSizeRatio
- the screen size ratiominimumSize
- the minimum size, may be nullmaximumSize
- the maximum size, may be null- Throws:
IllegalArgumentException
- in case ratio is not between 0 and 1
-