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
implements WindowListener
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 listSelectedInPicker()
 o setVisible(boolean)
 o windowActivated(WindowEvent)
 o windowClosed(WindowEvent)
 o windowClosing(WindowEvent)
 o windowDeactivated(WindowEvent)
 o windowDeiconified(WindowEvent)
 o windowIconified(WindowEvent)
 o windowOpened(WindowEvent)

Constructors

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

Methods

 o windowActivated
 public void windowActivated(WindowEvent event)
 o windowDeactivated
 public void windowDeactivated(WindowEvent event)
 o windowClosed
 public void windowClosed(WindowEvent event)
 o windowDeiconified
 public void windowDeiconified(WindowEvent event)
 o windowIconified
 public void windowIconified(WindowEvent event)
 o windowOpened
 public void windowOpened(WindowEvent event)
 o windowClosing
 public void windowClosing(WindowEvent event)
 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 setVisible
 public void setVisible(boolean b)
Overrides:
setVisible in class Component
 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