public class FontSelector
extends java.lang.Object
implements java.awt.event.ItemListener, javax.swing.event.ListSelectionListener
Modifier and Type | Field and Description |
---|---|
static int |
COMBOBOX_UI
Flag for combo box UI
|
static java.awt.Font |
DEFAULT_FONT
Default name
|
static java.lang.String |
DEFAULT_NAME
Default name
|
static int |
LIST_UI
Flag for a List UI
|
static java.lang.String[] |
styles
List of Styles
|
Constructor and Description |
---|
FontSelector()
Create a Font selector using the defaults.
|
FontSelector(int uiType,
boolean showLabels,
boolean showSample)
Create a font selector
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a listener.
|
javax.swing.JComponent |
getComponent()
Get the component
|
java.awt.Font |
getFont()
Get the font defined by the widget
|
java.lang.String |
getFontName()
Get the font family name
|
int |
getFontSize()
Get the font size
|
int |
getFontStyle()
Get the font style (Font.PLAIN, Font.BOLD, etc);
|
void |
itemStateChanged(java.awt.event.ItemEvent e)
Handle a change to a selection in any of the combo boxes.
|
static void |
main(java.lang.String[] s)
Test this class
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a listener.
|
void |
setFont(java.awt.Font f)
Set the font defined by the widget
|
void |
setFontName(java.lang.String fontName)
Set the font name
|
void |
setFontSize(int fontSize)
Set the font size
|
void |
setFontStyle(int fontStyle)
Set the Font style (Font.PLAIN, Font.ITALIC, etc);
|
void |
valueChanged(javax.swing.event.ListSelectionEvent e)
Handle a change to a selection in any of the lists.
|
public static final int COMBOBOX_UI
public static final int LIST_UI
public static final java.lang.String[] styles
public static final java.lang.String DEFAULT_NAME
public static final java.awt.Font DEFAULT_FONT
public FontSelector()
public FontSelector(int uiType, boolean showLabels, boolean showSample)
uiType
- UI typeshowLabels
- true to show labelsshowSample
- true to show sample text in the selected fontpublic void setFontName(java.lang.String fontName)
fontName
- the name of the font familypublic void setFontStyle(int fontStyle)
fontStyle
- style of the font.public void setFontSize(int fontSize)
fontSize
- size of the fontpublic java.lang.String getFontName()
public int getFontStyle()
public int getFontSize()
public javax.swing.JComponent getComponent()
public java.awt.Font getFont()
public void setFont(java.awt.Font f)
f
- the font.public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged
in interface java.awt.event.ItemListener
e
- eventpublic void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged
in interface javax.swing.event.ListSelectionListener
e
- eventpublic static void main(java.lang.String[] s)
s
- not usedpublic void addPropertyChangeListener(java.beans.PropertyChangeListener l)
l
- the listenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener l)
l
-