public class FontMap extends Object
FontModifier
s. Each FontMap
is associated
with exactly one CDockable
. This map is used to set the font
of various elements like titles or tabs. Changes in the map will
immediately be forwarded and applied.Modifier and Type | Field and Description |
---|---|
static String |
FONT_KEY_MINIMIZED_BUTTON
key for font used on the button for a minimized dockable
|
static String |
FONT_KEY_MINIMIZED_BUTTON_FOCUSED
key for font used on the focused button for a minimized dockable
|
static String |
FONT_KEY_TAB
key for font used on a tab
|
static String |
FONT_KEY_TAB_FOCUSED
key for font used on a focused tab
|
static String |
FONT_KEY_TAB_SELECTED
key for font used on a selected tab
|
static String |
FONT_KEY_TITLE
key for font used in titles
|
static String |
FONT_KEY_TITLE_FOCUSED
key for font used in titles if the title is focused
|
Constructor and Description |
---|
FontMap(CDockable dockable)
Creates a new map
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(FontMapListener listener)
Adds a listener to this map.
|
CDockable |
getDockable()
Gets the owner of this map.
|
FontModifier |
getFont(String key)
Gets the font which is associated with
key . |
void |
removeFont(String key)
Ensures that the original font is used for
key |
void |
removeListener(FontMapListener listener)
Removes
listener from this map. |
void |
setFont(String key,
Font font)
Sets the font which should be used for
key . |
void |
setFont(String key,
FontModifier font)
Sets the font for
key . |
void |
setFont(String key,
String... modifications)
Tells to use a font that is derived from the original font of
key . |
public static final String FONT_KEY_TITLE
public static final String FONT_KEY_TITLE_FOCUSED
public static final String FONT_KEY_MINIMIZED_BUTTON
public static final String FONT_KEY_MINIMIZED_BUTTON_FOCUSED
public static final String FONT_KEY_TAB
public static final String FONT_KEY_TAB_SELECTED
public static final String FONT_KEY_TAB_FOCUSED
public FontMap(CDockable dockable)
dockable
- the owner of this mappublic CDockable getDockable()
public void addListener(FontMapListener listener)
listener
- the new listenerpublic void removeListener(FontMapListener listener)
listener
from this map.listener
- the listener to removepublic FontModifier getFont(String key)
key
.key
- the key of the fontnull
public void setFont(String key, Font font)
key
.key
- the key of the fontfont
- the new font, can be null
public void setFont(String key, String... modifications)
key
. There are different modifications possible, all
have to be supplied in the same form: key=value
.setFont( x, "i=!", "b=+", s=14" );
would
create a modification that reverses the italic flag, sets any font
to bold and creates only fonts of size 14
number
number
number
key
- the key for the fontmodifications
- a set of modificationspublic void removeFont(String key)
key
key
- the key which should no longer use a modified fontpublic void setFont(String key, FontModifier font)
key
.key
- the key of the fontfont
- the new value or null
to set
the default value