Class JFontChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class JFontChooser extends JDialog
A dialog to prompt the user for a font. It has a static method to display the dialog and return a new Font instance.

Since:
2.6
Author:
Michael Bedward
See Also:
  • Constructor Details

    • JFontChooser

      public JFontChooser(JFrame owner, String title, Font initialFont)
      Constructor
      Parameters:
      owner - parent frame or null
      title - dialog title
      initialFont - the initial font for the chooser to display, or null for the GeoTools default font
    • JFontChooser

      public JFontChooser(JDialog owner, String title, Font initialFont)
      Constructor
      Parameters:
      owner - parent dialog or null
      title - dialog title
      initialFont - the initial font for the chooser to display, or null for the GeoTools default font
  • Method Details

    • showDialog

      public static Font showDialog(Component owner, String title, Font labelFont)
      Static method to display a JFontChooser dialog and return the selected font as a new Font object.
      Parameters:
      owner - the parent JFrame or JDialog; may be null
      title - dialog title
      labelFont - the initial font displayed by the dialog, or null for the default GeoTools font
      Returns:
      a new Font object or null if the user cancelled the dialog
    • completed

      public boolean completed()
      Query if the dialog was completed (user clicked the Apply button)
      Returns:
      true if completed; false otherwise
    • getSelectedFont

      public Font getSelectedFont()
      Get the selected font
      Returns:
      the selected font or null if the dialog was cancelled