Class JTextComponentScaler

All Implemented Interfaces:
HTMLScaler, Scaler

public class JTextComponentScaler
extends ComponentScaler
implements HTMLScaler
A JTextComponent-specific extension of ComponentScaler.
Author:
D. Garkov
  • Constructor Details

    • JTextComponentScaler

      public JTextComponentScaler​(float scaleFactor)
  • Method Details

    • scaleComponent

      public void scaleComponent​(JComponent immediateComponent)
      A method to be called when this JTextComponentScaler has been dispatched to some immediate Component to be scaled. This tackles the problem that after a complete application scaling, through the ScalingSlider, further components, initialized posterior, are not scaled. In order to do so, attach a scaler and call this method upon initialization.
      Overrides:
      scaleComponent in class ComponentScaler
      Parameters:
      immediateComponent - to be scaled
    • coscaleFont

      public void coscaleFont​(JComponent component)
      Description copied from class: ComponentScaler
      Scales all components that have their font not modified by the LAF-Scalers for one reason or another up to this point.
      Overrides:
      coscaleFont in class ComponentScaler
      Parameters:
      component - the JComponent, whose Font is to be scaled
    • coscaleHTML

      public void coscaleHTML​(JComponent component)
      Interface method for modifyHTML(String, JTextComponent). Part of the HTML-supporting interface contract.

      Be careful to update the font too, because this is taken as basis and thus the end HTML scaling depends on it.

      Specified by:
      coscaleHTML in interface HTMLScaler
      Parameters:
      component -
    • alignJEP

      public static void alignJEP​(JTextComponent text)
      JEditorPane has a couple of intrinsic properties, with the help of which, one could control to a certain extent, the layout (e.g. HTML) globally. These are JEditorPane.HONOR_DISPLAY_PROPERTIES and JEditorPane.W3C_LENGTH_UNITS.
      Parameters:
      text - JComponent to be checked, only JEditorPanes possess the system property to be set.