Interface AppearanceControl

All Superinterfaces:
nl.tudelft.simulation.dsol.swing.gui.appearance.AppearanceControl
All Known Implementing Classes:
AppearanceControlComboBox, AppearanceControlTextField, OtsControlPanel.ClockLabel, OtsControlPanel.TimeEdit, OtsSimulationPanel.AppearanceControlTabbedContentPane

public interface AppearanceControl extends nl.tudelft.simulation.dsol.swing.gui.appearance.AppearanceControl
This interface allows on screen items to not obtain colors and/or the font from an Appearance. This can be useful for items where considering only a background and a foreground color is not sufficient, possibly creating unreadable or otherwise unpleasant on screen items.

The default implementation of the methods in this interface return false, meaning the Appearance is completely ignored. In order to ignore it only partially, some methods should be overridden to return true. An example of this is given below, which will only allow the font of the Appearance. It also shows a convenient way to implement this interface when using default on screen items using a local class.
 class AppearanceControlComboBox<T> extends JComboBox<T> implements AppearanceControl
 {
     public boolean isFont()
     {
         return true;
     }
 }
 
 JComboBox<String> comboBox = new AppearanceControlComboBox<>();
 

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

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Default font size.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Integer
    Returns the font size.

    Methods inherited from interface nl.tudelft.simulation.dsol.swing.gui.appearance.AppearanceControl

    isBackground, isFont, isForeground
  • Field Details

    • DEFAULT_FONT_SIZE

      static final int DEFAULT_FONT_SIZE
      Default font size.
      See Also:
  • Method Details

    • getFontSize

      default Integer getFontSize()
      Returns the font size. May be null to ignore font size.
      Returns:
      Integer; font size, may be null to ignore font size from appearance.