Class AppearanceApplication

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

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

Copyright (c) 2023-2024 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:
  • Field Details

    • frameProperties

      protected Properties frameProperties
      Properties for the frame appearance (not simulation related).
  • 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 - JPanel; content pane.
  • Method Details

    • setFontScale

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

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

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

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

      public Appearance getAppearance()
      Returns the appearance.
      Returns:
      Appearance; 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.