org.jhotdraw.gui.fontchooser
Class DefaultFontChooserModel
- java.lang.Object
-
- org.jhotdraw.gui.fontchooser.AbstractFontChooserModel
-
- org.jhotdraw.gui.fontchooser.DefaultFontChooserModel
-
- All Implemented Interfaces:
- javax.swing.tree.TreeModel, FontChooserModel
- Direct Known Subclasses:
- DefaultFontChooserModel.UIResource
public class DefaultFontChooserModel extends AbstractFontChooserModel
DefaultFontChooserModel with a predefined set of font collections.Loading the fonts may take a lot of time. Therefore it is recommended to create a Future during the startup of an application, and set the fonts in the font chooser model when they are needed.
Example:
private static FutureTask future = new FutureTask(new Callable() { public Font[] call() throws Exception { return GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); } });
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classDefaultFontChooserModel.UIResource
-
Constructor Summary
Constructors Constructor and Description DefaultFontChooserModel()DefaultFontChooserModel(java.awt.Font[] fonts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.ObjectgetChild(java.lang.Object parent, int index)intgetChildCount(java.lang.Object parent)intgetIndexOfChild(java.lang.Object parent, java.lang.Object child)java.lang.ObjectgetRoot()booleanisEditable(javax.swing.tree.MutableTreeNode node)Returnstrueifnodeis editable by the user.booleanisLeaf(java.lang.Object node)voidsetFonts(java.awt.Font[] fonts)Sets the fonts of the DefaultFontChooserModel.voidvalueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)-
Methods inherited from class org.jhotdraw.gui.fontchooser.AbstractFontChooserModel
addTreeModelListener, getListeners, getTreeModelListeners, removeTreeModelListener
-
-
-
-
Constructor Detail
-
DefaultFontChooserModel
public DefaultFontChooserModel()
-
DefaultFontChooserModel
public DefaultFontChooserModel(java.awt.Font[] fonts)
-
-
Method Detail
-
setFonts
public void setFonts(java.awt.Font[] fonts)
Sets the fonts of the DefaultFontChooserModel.Fires treeStructureChanged event on the root node.
- Parameters:
fonts-
-
isEditable
public boolean isEditable(javax.swing.tree.MutableTreeNode node)
Description copied from interface:FontChooserModelReturnstrueifnodeis editable by the user. This method returns true, if the node and all its parents are editable.- Parameters:
node- a node in the tree, obtained from this data source- Returns:
- true if
nodeis editable
-
getRoot
public java.lang.Object getRoot()
-
getChild
public java.lang.Object getChild(java.lang.Object parent, int index)
-
getChildCount
public int getChildCount(java.lang.Object parent)
-
isLeaf
public boolean isLeaf(java.lang.Object node)
-
valueForPathChanged
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
-
getIndexOfChild
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG