java.lang.Object
is.codion.swing.common.ui.window.Windows
A utility class for windows.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidResizes the given window so that it isscreenSizeRatiopercent of the current screen sizestatic voidresize(Window window, double screenSizeRatio, @Nullable Dimension minimumSize, @Nullable Dimension maximumSize) Resizes the given window so that it isscreenSizeRatiopercent of the current screen size, within the given minimum and maximum sizesstatic voidresizeToFitScreen(Window window) Resizes the given window so that it fits within the usable screen bounds, excluding taskbars, panels and other desktop decorations.static DimensionscreenSizeRatio(double ratio)
-
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
-
resizeToFitScreen
Resizes the given window so that it fits within the usable screen bounds, excluding taskbars, panels and other desktop decorations.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 isscreenSizeRatiopercent 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, @Nullable Dimension minimumSize, @Nullable Dimension maximumSize) Resizes the given window so that it isscreenSizeRatiopercent 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
-