JHotDraw 7.2

org.jhotdraw.text
Class FontFormatter

java.lang.Object
  extended by javax.swing.JFormattedTextField.AbstractFormatter
      extended by javax.swing.text.DefaultFormatter
          extended by org.jhotdraw.text.FontFormatter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class FontFormatter
extends javax.swing.text.DefaultFormatter

FontFormatter is used to format fonts into a textual representation which can be edited in an entry field.

Version:
1.0 2009-04-17 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Constructor Summary
FontFormatter()
           
FontFormatter(boolean allowsNullValue)
           
 
Method Summary
static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory()
          Convenience method for creating a formatter factory with a FontFormatter.
static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory(boolean allowsNullValue)
          Convenience method for creating a formatter factory with a 8@code FontFormatter}.
 boolean getAllowsNullValue()
          Returns true, if null value is allowed.
 void setAllowsNullValue(boolean newValue)
          Sets whether a null value is allowed.
 java.lang.Object stringToValue(java.lang.String str)
           
 java.lang.String valueToString(java.lang.Object value)
           
 
Methods inherited from class javax.swing.text.DefaultFormatter
clone, getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getNavigationFilter, getOverwriteMode, getValueClass, install, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode, setValueClass
 
Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter
getActions, getFormattedTextField, invalidEdit, setEditValid, uninstall
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontFormatter

public FontFormatter()

FontFormatter

public FontFormatter(boolean allowsNullValue)
Method Detail

setAllowsNullValue

public void setAllowsNullValue(boolean newValue)
Sets whether a null value is allowed.

Parameters:
newValue -

getAllowsNullValue

public boolean getAllowsNullValue()
Returns true, if null value is allowed.


stringToValue

public java.lang.Object stringToValue(java.lang.String str)
                               throws java.text.ParseException
Overrides:
stringToValue in class javax.swing.text.DefaultFormatter
Throws:
java.text.ParseException

valueToString

public java.lang.String valueToString(java.lang.Object value)
                               throws java.text.ParseException
Overrides:
valueToString in class javax.swing.text.DefaultFormatter
Throws:
java.text.ParseException

createFormatterFactory

public static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory()
Convenience method for creating a formatter factory with a FontFormatter. Uses the RGB_INTEGER format and disallows null values.


createFormatterFactory

public static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory(boolean allowsNullValue)
Convenience method for creating a formatter factory with a 8@code FontFormatter}.


Copyright 1996-2009 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.