Class FontChooserPanelWithPreview

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class FontChooserPanelWithPreview extends BasePanel
A font selection panel.

Original code taken from here (BSD2).
Author:
Ian Darwin -- original code, FracPete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

    • FONT_SIZES

      public static final Integer[] FONT_SIZES
      The list of font sizes.
    • DEFAULT_FONT

      public static final String DEFAULT_FONT
      the default font.
      See Also:
    • DEFAULT_SIZE

      public static final Integer DEFAULT_SIZE
      The index of the default size.
    • m_Current

      protected Font m_Current
      The font the user has chosen.
    • m_ListFontName

      protected JList m_ListFontName
      The font name chooser.
    • m_ModelFontName

      protected DefaultListModel m_ModelFontName
      The font name chooser model.
    • m_ListFontSize

      protected JList m_ListFontSize
      The font size chooser.
    • m_CheckBoxBold

      protected JCheckBox m_CheckBoxBold
      The bold chooser.
    • m_CheckBoxItalic

      protected JCheckBox m_CheckBoxItalic
      The italic chooser.
    • m_TextSample

      protected JTextArea m_TextSample
      The display area.
    • m_IgnoreUpdates

      protected boolean m_IgnoreUpdates
      whether to ignore updates in the GUI temporarily.
  • Constructor Details

    • FontChooserPanelWithPreview

      public FontChooserPanelWithPreview()
  • Method Details

    • initGUI

      protected void initGUI()
      Initializes the widgets.
      Overrides:
      initGUI in class BasePanel
    • createFont

      protected Font createFont()
      Determines the font based on the current settings and returns it.
      Returns:
      the generate font
    • previewFont

      protected void previewFont()
      Called from the action handlers to get the font info, build a font, and set it.
    • setCurrent

      public void setCurrent(Font value)
      Sets the selected font. If null is provided, the default font/size will be used.
      Parameters:
      value - the font, can be null
      See Also:
    • getCurrent

      public Font getCurrent()
      Retrieve the selected font, or null.
      Returns:
      the selected font
    • main

      public static void main(String[] args)
      Simple main program to start it running.
      Parameters:
      args - ignored