public class GUIUtils extends Object
org.pepsoft.util.GUIUtils.disableScaling - set to true to force the scale to 100%
org.pepsoft.snapshotVersion - set to true to cause the UI scale preference to be loaded from a
separate, snapshot setting
Created by pepijn on 13-Jan-17.
| Modifier and Type | Field and Description |
|---|---|
static int |
SYSTEM_UI_SCALE
How many times to scale pixel sizes to display at approximately the
originally intended size for assets which were designed for 92-96 dpi
screens.
|
static float |
SYSTEM_UI_SCALE_FLOAT
The detected system default UI scale.
|
| Constructor and Description |
|---|
GUIUtils() |
| Modifier and Type | Method and Description |
|---|---|
static float |
getUIScale()
How many times to scale pixel sizes to display at approximately the
originally intended size for assets which were designed for 96 dpi
screens.
|
static int |
getUIScaleInt()
How many times to scale pixel sizes to display at approximately the
originally intended size for assets which were designed for 92-96 dpi
screens.
|
static void |
scaleLookAndFeel(float scale)
Adjusts the
UIManager defaults to show the Java 2D UI at the
specified scale. |
static void |
scaleToUI(Container container) |
static BufferedImage |
scaleToUI(Image image)
Scale an image according to
UI_SCALE. |
static BufferedImage |
scaleToUI(Image image,
boolean smooth)
Scale an image according to
UI_SCALE_FLOAT or UI_SCALE. |
static void |
scaleWindow(Window window) |
static void |
setUIScale(float uiScale)
Override the detected system default UI scale.
|
public static final float SYSTEM_UI_SCALE_FLOAT
Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
public static final int SYSTEM_UI_SCALE
This is UI_SCALE_FLOAT rounded to the nearest integer and is
intended for small images that don't scale well to non integer factors
such as icons.
Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
public static BufferedImage scaleToUI(Image image)
UI_SCALE. Nearest neighbour scaling
is used, in other words no smoothing or interpolation is applied.image - The image to scale.UI_SCALE is 1, or an
appropriately scaled copy otherwise.public static BufferedImage scaleToUI(Image image, boolean smooth)
UI_SCALE_FLOAT or UI_SCALE.image - The image to scale.smooth - Whether to do smooth scaling. When this is true,
the image is scaled to the floating point UI scale using
bicubic scaling. When it is false, it is scaled to
the UI scale rounded to the nearest integer, using nearest
neighbour scaling.UI_SCALE is 1, or an
appropriately scaled copy otherwise.public static void scaleToUI(Container container)
public static void scaleWindow(Window window)
public static void scaleLookAndFeel(float scale)
UIManager defaults to show the Java 2D UI at the
specified scale.public static void setUIScale(float uiScale)
uiScale - The UI scale to use instead of the detected system
default.public static float getUIScale()
Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
public static int getUIScaleInt()
This is getUIScale() rounded to the nearest integer and is
intended for small images that don't scale well to non integer factors
such as icons.
Note: for now UI scaling is only activated on Windows, until the current support on Mac and Linux can be investigated.
Copyright © 2011–2023 pepsoft.org. All rights reserved.