Class ScalingCoordinator

java.lang.Object
org.vanted.scaling.ScalingCoordinator

public class ScalingCoordinator
extends Object
It coordinates the scaling among the possible L&Fs and initiates Components- scaling. Through delegation the main types are ordered and then accordingly scaled. First LAF-Defaults, afterwards all the user-set resizable components.

Big Scale Operations (e.g. DPI-Scale factor of 50) require additional heap space!

Author:
D. Garkov
  • Constructor Details

    • ScalingCoordinator

      public ScalingCoordinator​(float factor, Container main)
      Parameters:
      factor - the processed Slider value
      main - the main container
    • ScalingCoordinator

      public ScalingCoordinator​(Container main)
      This uses the preferences-stored factor. Suitable for initial modifications.
      Parameters:
      main - the main container
    • ScalingCoordinator

      public ScalingCoordinator​(Container main, boolean components)
      Parameters:
      main - the main container
      components - false: scale LAF Defaults only
    • ScalingCoordinator

      public ScalingCoordinator()
      Empty Coordinator. You should refresh the GUI thereafter by yourself.
  • Method Details

    • scaleDefaults

      public void scaleDefaults​(float factor)
      Scaling Look & Feel Defaults.
      Parameters:
      factor - the required new DPI Factor, from which a scaling ratio would be constructed.
    • adjustDefaults

      public void adjustDefaults​(Scaler delegate)
      Scan Defaults and re-scale the appropriate values. Important Note: To scale any added defaults, these must be added to the UIManager.getLookAndFeelDefaults().
      Parameters:
      delegate -
    • scaleComponents

      public void scaleComponents​(float factor, Container main)
      Scales JComponents.
      Parameters:
      factor - the scaling ratio from system DPI & requested DPI
    • refreshGUI

      public static void refreshGUI​(Container main)
      Call after each major scaling operation.
      Parameters:
      main - the main container