Class gjt.FontDialog
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gjt.FontDialog

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Dialog
                                   |
                                   +----gjt.FontDialog

public class FontDialog
extends Dialog
A dialog used for selecting a font. FontDialog is constructed with a Frame, DialogClient, initial font to display, and boolean that indicates modality.

FontDialog contains a preview panel which previews the currently selected font. Updating of the preview panel is triggered by a preview button at the bottom of the dialog.

FontDialog contains 3 methods which define the labels for the buttons it contains:

String getPreviewButtonLabel()
String getOkButtonLabel()
String getCancelButtonLabel()

By default the 3 methods return "Preview", "Ok" and "Cancel" respectively. FontDialog may be extended and the 3 methods overridden to customize the labels displayed in the buttons.

FontDialog uses Toolkit to get a list of fonts by invoking Toolkit.getFontList(). This is done in the getFontNames() method, which may be overridden by extensions of FontDialog in case the standard set of font names are inadequate.

Finally, font sizes are obtained by the getFontSizes() method. FontDialog defines 8 sizes by default: 8, 12, 14, 16, 18, 24, 48 and 64. Extensions of FontDialog may override getFontSizes() to provide a different list of sizes.

See gjt.test.FontDialogTest for an example of an extension of FontDialog which overrides the methods discussed above.

See Also:
Dialog, Toolkit, DialogClient, FontDialogTest

Constructor Index

 o FontDialog(Frame, DialogClient, Font, boolean)

Method Index

 o done(Font)
 o getCancelButtonLabel()
 o getFontNames()
 o getFontSelected()
 o getFontSizes()
 o getOkButtonLabel()
 o getPreviewButtonLabel()
 o handleEvent(Event)
 o listSelectedInPicker()
 o show()

Constructors

 o FontDialog
  public FontDialog(Frame frame,
                    DialogClient client,
                    Font font,
                    boolean modal)

Methods

 o handleEvent
  public boolean handleEvent(Event event)
Overrides:
handleEvent in class Component
 o getFontNames
  public String[] getFontNames()
 o getFontSizes
  public String[] getFontSizes()
 o getPreviewButtonLabel
  public String getPreviewButtonLabel()
 o getOkButtonLabel
  public String getOkButtonLabel()
 o getCancelButtonLabel
  public String getCancelButtonLabel()
 o show
  public void show()
Overrides:
show in class Window
 o done
  public void done(Font font)
 o getFontSelected
  public Font getFontSelected()
 o listSelectedInPicker
  public void listSelectedInPicker()

All Packages  Class Hierarchy  This Package  Previous  Next  Index