Package org.vanted.scaling.scalers
Class BasicScaler
java.lang.Object
org.vanted.scaling.scalers.BasicScaler
- All Implemented Interfaces:
Scaler
- Direct Known Subclasses:
ComponentScaler
,NimbusScaler
,WindowsScaler
public class BasicScaler extends Object implements Scaler
This scales the following: all fonts, all integers specified in
LOWER_SUFFIXES_INTEGERS
, all icons and all insets. This
might be later referred as the 4 specifics. For exact LAF implementations
consider NimbusScaler
and WindowsScaler
.- Author:
- D. Garkov
-
Constructor Summary
Constructors Constructor Description BasicScaler(float scaleFactor)
-
Method Summary
Modifier and Type Method Description float
getScaleFactor()
The current scaling factor.void
initialScaling()
Used for synchronized LAFs, where only one change (e.g.Font
modifyFont(Object key, Font original)
Implement to modify Fonts.Icon
modifyIcon(Object key, Icon icon)
Interface method formodifyImageIcon(javax.swing.Icon)
andmodifyIcon(java.lang.Object,javax.swing.Icon)
.Insets
modifyInsets(Insets original)
Interface method formodifyInsets(java.awt.Insets)
, encapsulating the delegation and performing differentiating.Integer
modifyInteger(Object key, Integer original)
Modifies Integers defined in the LookAndFeel map of UIDefaults.void
setScaleFactor(float scaleFactor)
Set new scaling factor.
-
Constructor Details
-
BasicScaler
public BasicScaler(float scaleFactor)
-
-
Method Details
-
getScaleFactor
public float getScaleFactor()The current scaling factor.- Returns:
- the scaleFactor
-
setScaleFactor
public void setScaleFactor(float scaleFactor)Set new scaling factor.- Parameters:
scaleFactor
- the scaleFactor to set
-
initialScaling
public void initialScaling()Description copied from interface:Scaler
Used for synchronized LAFs, where only one change (e.g. Font) is sufficient (e.g. Nimbus).- Specified by:
initialScaling
in interfaceScaler
-
modifyFont
Description copied from interface:Scaler
Implement to modify Fonts.- Specified by:
modifyFont
in interfaceScaler
- Parameters:
key
- UIDefaults keyoriginal
- instance to be scaled- Returns:
- newly scaled instance
-
modifyInteger
Modifies Integers defined in the LookAndFeel map of UIDefaults.- Specified by:
modifyInteger
in interfaceScaler
- Parameters:
key
- UIDefaults keyoriginal
- instance to be scaled- Returns:
- newly scaled instance
-
modifyInsets
Interface method formodifyInsets(java.awt.Insets)
, encapsulating the delegation and performing differentiating.- Specified by:
modifyInsets
in interfaceScaler
- Parameters:
original
- an Insets instance to be scaled- Returns:
- a newly scaled instance or null
-
modifyIcon
Interface method formodifyImageIcon(javax.swing.Icon)
andmodifyIcon(java.lang.Object,javax.swing.Icon)
.- Specified by:
modifyIcon
in interfaceScaler
- Parameters:
icon
- to be scaledkey
- UIDefaults key- Returns:
- newly scaled instance of either
ImageIcon
orIconUIResource
.
-