Class FontChooserPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class FontChooserPanel extends AbstractChooserPanel<Font>
A panel that contains a text field with the current Font and a button for bringing up a Font dialog.
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

    • m_FontChooser

      protected FontChooser m_FontChooser
      the dialog to use.
  • Constructor Details

    • FontChooserPanel

      public FontChooserPanel()
      Initializes the panel with the default sans font.
    • FontChooserPanel

      public FontChooserPanel(Font font)
      Initializes the panel with the given font.
      Parameters:
      font - the color to use
  • Method Details

    • getSelectionColumns

      protected int getSelectionColumns()
      Returns the number of columns in the selection text field.
      Overrides:
      getSelectionColumns in class AbstractChooserPanel<Font>
      Returns:
      the number of columns
    • doChoose

      protected Font doChoose()
      Performs the actual choosing of an object.
      Specified by:
      doChoose in class AbstractChooserPanel<Font>
      Returns:
      the chosen object or null if none chosen
    • toString

      protected String toString(Font value)
      Converts the value into its string representation.
      Specified by:
      toString in class AbstractChooserPanel<Font>
      Parameters:
      value - the value to convert
      Returns:
      the generated string
    • fromString

      protected Font fromString(String value)
      Converts the string representation into its object representation.
      Specified by:
      fromString in class AbstractChooserPanel<Font>
      Parameters:
      value - the string value to convert
      Returns:
      the generated object
    • encodeFont

      public static String encodeFont(Font f)
      Turns a font into a string representation that can get parsed with Font.decode(String) again.
      Parameters:
      f - the font to turn into a string
      Returns:
      the font