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 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 interface Scaler
    • modifyFont

      public Font modifyFont​(Object key, Font original)
      Description copied from interface: Scaler
      Implement to modify Fonts.
      Specified by:
      modifyFont in interface Scaler
      Parameters:
      key - UIDefaults key
      original - instance to be scaled
      Returns:
      newly scaled instance
    • modifyInteger

      public Integer modifyInteger​(Object key, Integer original)
      Modifies Integers defined in the LookAndFeel map of UIDefaults.
      Specified by:
      modifyInteger in interface Scaler
      Parameters:
      key - UIDefaults key
      original - instance to be scaled
      Returns:
      newly scaled instance
    • modifyInsets

      public Insets modifyInsets​(Insets original)
      Interface method for modifyInsets(java.awt.Insets), encapsulating the delegation and performing differentiating.
      Specified by:
      modifyInsets in interface Scaler
      Parameters:
      original - an Insets instance to be scaled
      Returns:
      a newly scaled instance or null
    • modifyIcon

      public Icon modifyIcon​(Object key, Icon icon)
      Interface method for modifyImageIcon(javax.swing.Icon) and modifyIcon(java.lang.Object,javax.swing.Icon).
      Specified by:
      modifyIcon in interface Scaler
      Parameters:
      icon - to be scaled
      key - UIDefaults key
      Returns:
      newly scaled instance of either ImageIcon or IconUIResource.