Package org.opentrafficsim.swing.gui
Interface AppearanceControl
- All Known Implementing Classes:
OTSControlPanel.ClockLabel
,OTSControlPanel.TimeEdit
public interface AppearanceControl
This interface allows on screen items to not obtain colors and/or the font from an
The default implementation of the methods in this interface return
BSD-style license. See OpenTrafficSim License.
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-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 6 feb. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Method Summary
Modifier and Type Method Description default boolean
isBackground()
Returns whether this item has a controllable background.default boolean
isFont()
Returns whether this item has a controllable font.default boolean
isForeground()
Returns whether this item has a controllable foreground.
-
Method Details
-
isBackground
default boolean isBackground()Returns whether this item has a controllable background.- Returns:
- whether this item has a controllable background
-
isForeground
default boolean isForeground()Returns whether this item has a controllable foreground.- Returns:
- whether this item has a controllable foreground
-
isFont
default boolean isFont()Returns whether this item has a controllable font.- Returns:
- whether this item has a controllable font
-