public class FontControls extends Object
This class assumes that it will be laying out its components using the standard GridBagLayouter.
Users of this class should implement the FontChangedListener interface to be informed when the selected font is updated.
Modifier and Type | Field and Description |
---|---|
protected String |
currentFont
Selected font name
|
protected int |
currentSize
Selected font size.
|
protected int |
currentStyle
Selected font style.
|
protected JComboBox |
fontBox
List of all available font families.
|
protected EventListenerList |
listeners |
protected JComboBox |
sizeBox
List of pre-selected sizes.
|
protected JComboBox |
styleBox
List of possible styles.
|
protected static int[] |
styleInts
Styles as indexed array.
|
protected static String[] |
styleStrings
Styles as formatted string.
|
Constructor and Description |
---|
FontControls(GridBagLayouter layouter,
String postfix)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFonts()
Add all the available fonts.
|
void |
addListener(FontChangedListener l)
Registers a listener who wants to be informed about font
changes.
|
protected void |
fireChanged()
Send FontChangedEvent event to all listeners.
|
Font |
getSelectedFont()
Get the selected font.
|
void |
setDefaults()
Set/reset interface to default values.
|
void |
setFont(Font font)
Set the control to match a given font.
|
protected void |
setFontName()
Set a new default font name from the value in the font name
combobox.
|
protected void |
setSize()
Set a new default font size from the value in the size
combobox.
|
protected void |
setStyle()
Set the font style from the value in the style combobox.
|
protected JComboBox styleBox
protected JComboBox sizeBox
protected JComboBox fontBox
protected String currentFont
protected int currentSize
protected int currentStyle
protected static final String[] styleStrings
protected static final int[] styleInts
protected EventListenerList listeners
public FontControls(GridBagLayouter layouter, String postfix)
public void setDefaults()
protected void addFonts()
protected void setFontName()
protected void setSize()
protected void setStyle()
public Font getSelectedFont()
public void setFont(Font font)
public void addListener(FontChangedListener l)
l
- the FontChangedListener listener.protected void fireChanged()
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.