public class DefaultFontSelectionModel extends Object implements FontSelectionModel
FontSelectionModel.Font| Constructor and Description |
|---|
DefaultFontSelectionModel(Font font)
Creates a
DefaultFontSelectionModel with the
current font set to font, which should be
non-null. |
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(ChangeListener listener)
Adds a
ChangeListener to the model. |
ChangeListener[] |
getChangeListeners()
Returns an array of all the
ChangeListeners added
to this DefaultFontSelectionModel with
addChangeListener. |
Font |
getSelectedFont()
Returns the selected
Font which should be
non-null. |
String |
getSelectedFontFamily()
Returns the family name of the selected font
|
String |
getSelectedFontName()
Returns the name of the selected font
|
int |
getSelectedFontSize()
Returns the size of the selected font
|
void |
removeChangeListener(ChangeListener listener)
Removes a
ChangeListener from the model. |
void |
setSelectedFont(Font font)
Sets the selected font to
font. |
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 Fontpublic Font getSelectedFont()
Font which should be
non-null.getSelectedFont in interface FontSelectionModelFontFontSelectionModel.setSelectedFont(java.awt.Font)public String getSelectedFontName()
FontSelectionModelgetSelectedFontName in interface FontSelectionModelpublic String getSelectedFontFamily()
FontSelectionModelgetSelectedFontFamily in interface FontSelectionModelpublic int getSelectedFontSize()
FontSelectionModelgetSelectedFontSize in interface FontSelectionModelpublic 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 FontSelectionModelfont - the new FontFontSelectionModel.getSelectedFont(),
FontSelectionModel.addChangeListener(javax.swing.event.ChangeListener)public void addChangeListener(ChangeListener listener)
ChangeListener to the model.addChangeListener in interface FontSelectionModellistener - the ChangeListener to be addedpublic void removeChangeListener(ChangeListener listener)
ChangeListener from the model.removeChangeListener in interface FontSelectionModellistener - the ChangeListener to be removedpublic ChangeListener[] getChangeListeners()
ChangeListeners added
to this DefaultFontSelectionModel with
addChangeListener.ChangeListeners added, or an empty
array if no listeners have been addedCopyright © 2016–2022 drjekyll.org. All rights reserved.