Class AppearanceApplication

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
OtsSimulationApplication

public class AppearanceApplication extends JFrame
Application with global appearance control. Subclasses should call setDefaultFont() before any GUI elements are created (unless this is the first GUI element). Subclasses should call setAppearance(org.opentrafficsim.swing.gui.Appearance)(getAppearance()) once all elements have been added to the GUI.

Copyright (c) 2023-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
See Also:
  • Constructor Details

    • AppearanceApplication

      public AppearanceApplication()
      Constructor that uses the default content pane.
    • AppearanceApplication

      public AppearanceApplication(JPanel panel)
      Constructor that sets the content pane.
      Parameters:
      panel - content pane
  • Method Details

    • setFontScale

      public void setFontScale(String fontScaleKey)
      Set font scale.
      Parameters:
      fontScaleKey - font scale name
    • setAppearance

      public void setAppearance(Appearance appearance)
      Sets an appearance.
      Parameters:
      appearance - appearance
    • changeFont

      protected void changeFont(Component c, String font)
      Change font on component.
      Parameters:
      c - component
      font - font name
    • changeFontSize

      protected void changeFontSize(Component c)
      Changes the font size of the component.
      Parameters:
      c - component
    • getAppearance

      public Appearance getAppearance()
      Returns the appearance.
      Returns:
      appearance
    • setDefaultFont

      public static void setDefaultFont()
      Sets default font in the UIManager. This should be invoked by any application before any GUI element is created.