Class FontSelector

java.lang.Object
ucar.unidata.ui.FontSelector
All Implemented Interfaces:
ItemListener, EventListener, ListSelectionListener

public class FontSelector extends Object implements ItemListener, ListSelectionListener
A widget for selecting a font.
  • Field Details

    • COMBOBOX_UI

      public static final int COMBOBOX_UI
      Flag for combo box UI
      See Also:
    • LIST_UI

      public static final int LIST_UI
      Flag for a List UI
      See Also:
    • styles

      public static final String[] styles
      List of Styles
    • DEFAULT_NAME

      public static final String DEFAULT_NAME
      Default name
      See Also:
    • DEFAULT_FONT

      public static final Font DEFAULT_FONT
      Default name
  • Constructor Details

    • FontSelector

      public FontSelector()
      Create a Font selector using the defaults.
    • FontSelector

      public FontSelector(int uiType, boolean showLabels, boolean showSample)
      Create a font selector
      Parameters:
      uiType - UI type
      showLabels - true to show labels
      showSample - true to show sample text in the selected font
  • Method Details

    • setFontName

      public void setFontName(String fontName)
      Set the font name
      Parameters:
      fontName - the name of the font family
    • setFontStyle

      public void setFontStyle(int fontStyle)
      Set the Font style (Font.PLAIN, Font.ITALIC, etc);
      Parameters:
      fontStyle - style of the font.
    • setFontSize

      public void setFontSize(int fontSize)
      Set the font size
      Parameters:
      fontSize - size of the font
    • getFontName

      public String getFontName()
      Get the font family name
      Returns:
      name of the font family
    • getFontStyle

      public int getFontStyle()
      Get the font style (Font.PLAIN, Font.BOLD, etc);
      Returns:
      font style
    • getFontSize

      public int getFontSize()
      Get the font size
      Returns:
      the font size
    • getComponent

      public JComponent getComponent()
      Get the component
      Returns:
      the UI component
    • getFont

      public Font getFont()
      Get the font defined by the widget
      Returns:
      the font.
    • setFont

      public void setFont(Font f)
      Set the font defined by the widget
      Parameters:
      f - the font.
    • itemStateChanged

      public void itemStateChanged(ItemEvent e)
      Handle a change to a selection in any of the combo boxes.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      e - event
    • valueChanged

      public void valueChanged(ListSelectionEvent e)
      Handle a change to a selection in any of the lists.
      Specified by:
      valueChanged in interface ListSelectionListener
      Parameters:
      e - event
    • main

      public static void main(String[] s)
      Test this class
      Parameters:
      s - not used
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
      Add a listener.
      Parameters:
      l - the listener
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener l)
      Remove a listener.
      Parameters:
      l -