Class ComponentScaler
java.lang.Object
org.vanted.scaling.scalers.BasicScaler
org.vanted.scaling.scalers.component.ComponentScaler
- All Implemented Interfaces:
Scaler
- Direct Known Subclasses:
AbstractButtonScaler
,JLabelScaler
,JOptionPaneScaler
,JSplitPaneScaler
,JTabbedPaneScaler
,JTextComponentScaler
,WindowScaler
public class ComponentScaler extends BasicScaler
Applicable to initiated Swing Components. It scales specifics that have been
overwritten by design only, making sure LAF-Defaults are not scaled again.
So, it is a kind of co-scaler to any of the LAF-Scalers.
To obtain a scaling factor, you could call
DPIHelper.getDPIScalingRatio()
Current (default) subtypes:
AbstractButtonScaler
JLabelScaler
JOptionPaneScaler
JSplitPaneScaler
JTabbedPaneScaler
JTextComponentScaler
- Author:
- D. Garkov
-
Constructor Summary
Constructors Constructor Description ComponentScaler(float scaleFactor)
-
Method Summary
Modifier and Type Method Description void
coscaleFont(JComponent component)
Scales all components that have their font not modified by the LAF-Scalers for one reason or another up to this point.void
coscaleIcon(JComponent component)
Left to subtypes.void
coscaleInsets(JComponent component)
Modifies non-null Insets of JComponent.void
scaleComponent(JComponent immediateComponent)
A method to be called when this ComponentScaler has been dispatched to some immediate JComponent to be scaled - both from the centralComponentRegulator
and on its own.Methods inherited from class org.vanted.scaling.scalers.BasicScaler
getScaleFactor, initialScaling, modifyFont, modifyIcon, modifyInsets, modifyInteger, setScaleFactor
-
Constructor Details
-
ComponentScaler
public ComponentScaler(float scaleFactor)
-
-
Method Details
-
scaleComponent
A method to be called when this ComponentScaler has been dispatched to some immediate JComponent to be scaled - both from the centralComponentRegulator
and on its own. A reason for a call outside the usual scaling routine could be an initialization of new components with overwritten, i.e custom-set, LAF Defaults, post-scaling. Attach a scaler and call this method after done with the initialization. For more specific JComponents, see the direct known subclasses.- Parameters:
immediateComponent
- to be scaled
-
coscaleFont
Scales all components that have their font not modified by the LAF-Scalers for one reason or another up to this point.- Parameters:
component
- the JComponent, whose Font is to be scaled
-
coscaleInsets
Modifies non-null Insets of JComponent.- Parameters:
component
- the JComponent, whose Insets are to be scaled
-
coscaleIcon
Left to subtypes. There are implementations for the following JComponents:AbstractButton, JLabel, JOptionPane, JTabbedPane.
- Parameters:
component
- Component having Icon
-