Package ucar.unidata.ui
Class FontSelector
java.lang.Object
ucar.unidata.ui.FontSelector
- All Implemented Interfaces:
ItemListener
,EventListener
,ListSelectionListener
A widget for selecting a font.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a Font selector using the defaults.FontSelector
(int uiType, boolean showLabels, boolean showSample) Create a font selector -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener.Get the componentgetFont()
Get the font defined by the widgetGet the font family nameint
Get the font sizeint
Get the font style (Font.PLAIN, Font.BOLD, etc);void
Handle a change to a selection in any of the combo boxes.static void
Test this classvoid
Remove a listener.void
Set the font defined by the widgetvoid
setFontName
(String fontName) Set the font namevoid
setFontSize
(int fontSize) Set the font sizevoid
setFontStyle
(int fontStyle) Set the Font style (Font.PLAIN, Font.ITALIC, etc);void
Handle a change to a selection in any of the lists.
-
Field Details
-
COMBOBOX_UI
public static final int COMBOBOX_UIFlag for combo box UI- See Also:
-
LIST_UI
public static final int LIST_UIFlag for a List UI- See Also:
-
styles
List of Styles -
DEFAULT_NAME
Default name- See Also:
-
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 typeshowLabels
- true to show labelsshowSample
- true to show sample text in the selected font
-
-
Method Details
-
setFontName
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
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
Get the component- Returns:
- the UI component
-
getFont
Get the font defined by the widget- Returns:
- the font.
-
setFont
Set the font defined by the widget- Parameters:
f
- the font.
-
itemStateChanged
Handle a change to a selection in any of the combo boxes.- Specified by:
itemStateChanged
in interfaceItemListener
- Parameters:
e
- event
-
valueChanged
Handle a change to a selection in any of the lists.- Specified by:
valueChanged
in interfaceListSelectionListener
- Parameters:
e
- event
-
main
Test this class- Parameters:
s
- not used
-
addPropertyChangeListener
Add a listener.- Parameters:
l
- the listener
-
removePropertyChangeListener
Remove a listener.- Parameters:
l
-
-