ucar.unidata.ui
Class FontSelector

java.lang.Object
  extended by 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 Summary
static int COMBOBOX_UI
          Flag for combo box UI
static Font DEFAULT_FONT
          Default name
static String DEFAULT_NAME
          Default name
static int LIST_UI
          Flag for a List UI
static String[] styles
          List of Styles
 
Constructor Summary
FontSelector()
          Create a Font selector using the defaults.
FontSelector(int uiType, boolean showLabels, boolean showSample)
          Create a font selector
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Add a listener.
 JComponent getComponent()
          Get the component
 Font getFont()
          Get the font defined by the widget
 String getFontName()
          Get the font family name
 int getFontSize()
          Get the font size
 int getFontStyle()
          Get the font style (Font.PLAIN, Font.BOLD, etc);
 void itemStateChanged(ItemEvent e)
          Handle a change to a selection in any of the combo boxes.
static void main(String[] s)
          Test this class
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a listener.
 void setFont(Font f)
          Set the font defined by the widget
 void setFontName(String fontName)
          Set the font name
 void setFontSize(int fontSize)
          Set the font size
 void setFontStyle(int fontStyle)
          Set the Font style (Font.PLAIN, Font.ITALIC, etc);
 void valueChanged(ListSelectionEvent e)
          Handle a change to a selection in any of the lists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMBOBOX_UI

public static final int COMBOBOX_UI
Flag for combo box UI

See Also:
Constant Field Values

LIST_UI

public static final int LIST_UI
Flag for a List UI

See Also:
Constant Field Values

styles

public static final String[] styles
List of Styles


DEFAULT_NAME

public static final String DEFAULT_NAME
Default name

See Also:
Constant Field Values

DEFAULT_FONT

public static final Font DEFAULT_FONT
Default name

Constructor Detail

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 Detail

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 -