java.lang.Object
is.codion.swing.common.ui.Windows
A utility class for windows, dialogs and frames.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Windows.FrameBuilder
frame
(JComponent component) static void
resizeWindow
(Window window, double screenSizeRatio) Resizes the given window so that it isscreenSizeRatio
percent of the current screen sizestatic void
resizeWindow
(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 sizesstatic Dimension
screenSizeRatio
(double ratio) static void
setSizeWithinScreenBounds
(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
-
setSizeWithinScreenBounds
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
-
resizeWindow
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
-
resizeWindow
public static void resizeWindow(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
-
frame
- Parameters:
component
- the component to display in the frame- Returns:
- a frame builder
-