|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.connectina.swing.fontchooser.DefaultFontSelectionModel
public class DefaultFontSelectionModel
A generic implementation of FontSelectionModel
.
Font
Field Summary | |
---|---|
protected ChangeEvent |
changeEvent
Only one ChangeEvent is needed per model instance
since the event's only (read-only) state is the source property. |
protected EventListenerList |
listenerList
A list of registered event listeners. |
Constructor Summary | |
---|---|
DefaultFontSelectionModel()
Creates a DefaultFontSelectionModel with the
current font set to new Font(Font.SANS_SERIF, Font.PLAIN, 12)
. |
|
DefaultFontSelectionModel(Font font)
Creates a DefaultFontSelectionModel with the
current font set to font , which should be
non-null . |
Method Summary | |
---|---|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener to the model. |
protected void |
fireStateChanged()
Runs each ChangeListener 's
stateChanged method. |
List<String> |
getAvailableFontNames()
Gets the available font names. |
ChangeListener[] |
getChangeListeners()
Returns an array of all the ChangeListener s added
to this DefaultFontSelectionModel with
addChangeListener . |
Font |
getSelectedFont()
Returns the selected Font which should be
non-null . |
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from the model. |
void |
setSelectedFont(Font font)
Sets the selected font to font . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient ChangeEvent changeEvent
ChangeEvent
is needed per model instance
since the event's only (read-only) state is the source property.
The source of events generated here is always "this".
protected EventListenerList listenerList
Constructor Detail |
---|
public DefaultFontSelectionModel()
DefaultFontSelectionModel
with the
current font set to new Font(Font.SANS_SERIF, Font.PLAIN, 12)
. This is the default constructor.
public DefaultFontSelectionModel(Font font)
DefaultFontSelectionModel
with the
current font set to font
, which should be
non-null
. Note that setting the font to
null
is undefined and may have unpredictable
results.
font
- the new Font
Method Detail |
---|
public Font getSelectedFont()
Font
which should be
non-null
.
getSelectedFont
in interface FontSelectionModel
Font
FontSelectionModel.setSelectedFont(java.awt.Font)
public void setSelectedFont(Font font)
font
.
Note that setting the font to null
is undefined and may have unpredictable results.
This method fires a state changed event if it sets the
current font to a new non-null
font;
if the new font is the same as the current font,
no event is fired.
setSelectedFont
in interface FontSelectionModel
font
- the new Font
FontSelectionModel.getSelectedFont()
,
FontSelectionModel.addChangeListener(javax.swing.event.ChangeListener)
public List<String> getAvailableFontNames()
GraphicsEnvironment
localized for the default locale,
as returned by Locale.getDefault()
.
getAvailableFontNames
in interface FontSelectionModel
public void addChangeListener(ChangeListener l)
ChangeListener
to the model.
addChangeListener
in interface FontSelectionModel
l
- the ChangeListener
to be addedpublic void removeChangeListener(ChangeListener l)
ChangeListener
from the model.
removeChangeListener
in interface FontSelectionModel
l
- the ChangeListener
to be removedpublic ChangeListener[] getChangeListeners()
ChangeListener
s added
to this DefaultFontSelectionModel
with
addChangeListener
.
ChangeListener
s added, or an empty
array if no listeners have been addedprotected void fireStateChanged()
ChangeListener
's
stateChanged
method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |