Class WindowScaler
java.lang.Object
org.vanted.scaling.scalers.BasicScaler
org.vanted.scaling.scalers.component.ComponentScaler
org.vanted.scaling.scalers.component.WindowScaler
- All Implemented Interfaces:
Scaler
public class WindowScaler extends ComponentScaler
Extension of ComponentScaler, responsible for Window-derived
components' decorations scaling.
- Author:
- D. Garkov
-
Constructor Summary
Constructors Constructor Description WindowScaler(float scaleFactor)
-
Method Summary
Modifier and Type Method Description static void
attachSystemWindowResizer()
Attach a WindowResizerListener to the default system window Toolkit.void
coscaleIcon(Component component)
Scales JFrame and JDialog icons.static float
getPreviousRatio()
static void
resizeWindow(Component window, boolean isPersistent)
Resizes window components.void
scaleComponent(Component immediateComponent)
A method to be called when this WindowScaler has been dispatched to some immediate Component to be scaled.Methods inherited from class org.vanted.scaling.scalers.component.ComponentScaler
coscaleFont, coscaleIcon, coscaleInsets, scaleComponent
Methods inherited from class org.vanted.scaling.scalers.BasicScaler
getScaleFactor, initialScaling, modifyFont, modifyIcon, modifyInsets, modifyInteger, setScaleFactor
-
Constructor Details
-
WindowScaler
public WindowScaler(float scaleFactor)
-
-
Method Details
-
scaleComponent
A method to be called when this WindowScaler has been dispatched to some immediate Component to be scaled.Note: Use this only when JFrame or JDialog, are *not* LookAndFeel decorated. Otherwise, this has no effect (Metal LookAndFeel tested). Doesn't override
ComponentScaler.coscaleIcon(javax.swing.JComponent)
!- Parameters:
immediateComponent
- to be scaled
-
coscaleIcon
Scales JFrame and JDialog icons. Doesn't overrideComponentScaler.coscaleIcon(javax.swing.JComponent)
!- Parameters:
component
-
-
attachSystemWindowResizer
public static void attachSystemWindowResizer()Attach a WindowResizerListener to the default system window Toolkit. -
resizeWindow
Resizes window components. If the window is not scaling-persistent then its actual scaled size is adjusted by scale-back value, meaning it is scaled only up to a given percentage out of the full scaling factor. Default system windows (through usage ofattachSystemWindowResizer()
) are set to be impersistent, e.g. dialogs.- Parameters:
window
- to be resizedisPersistent
- if the window instance would persist through and get rescaled
-
getPreviousRatio
public static float getPreviousRatio()- Returns:
- last most recently used scaling ratio/factor.
-