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
resize
(Window window, double screenSizeRatio, @Nullable Dimension minimumSize, @Nullable Dimension maximumSize) Resizes the given window so that it isscreenSizeRatio
percent of the current screen size, within the given minimum and maximum sizesstatic void
resizeToFitScreen
(Window window) Resizes the given window so that if fits within its screen bounds.static Dimension
screenSizeRatio
(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 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
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, @Nullable Dimension minimumSize, @Nullable 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
-