borland Packages  Class Hierarchy  dbswing Package 

FontChooser component

java.lang.Object
   +----com.borland.dbswing.FontChooser

About the FontChooser component

Constructors  Properties  Methods  

Implements Serializable

Note: This is a feature of JBuilder Professional and Enterprise.

FontChooser is used to prompt a user to select a font name, style, and size. These are some of the useful features of FontChooser:

Working with FontChooser, you customize the initial display of font selection dialog with the following properties:

To display the FontChooser, set the frame property to a parent Frame for the dialog box and then call the showDialog() method.

When the dialog box appears, the user works with the dialog box to select a font and sets its attributes. If the user makes a font selection in the dialog box and chooses the OK button, showDialog() saves the user's selection as the selectedFont property. Your application can then inspect the selectedFont property value to determine the user's selection. The showDialog() method returns true if the user selects a font and chooses the OK button.


FontChooser constructors

FontChooser properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

FontChooser methods

Methods implemented in this class

Methods implemented in java.lang.Object


FontChooser constructors

FontChooser()

  public FontChooser()
Constructs a modal FontChooser without a parent frame and title. Calls the constructor of this class that takes a Frame, a String, and a boolean as parameters. Passes default values of null, an empty string (""), and true to the other constructor.

FontChooser(java.awt.Frame, java.lang.String)

  public FontChooser(Frame frame, String title)
Constructs a FontChooser with a specified parent frame and a specified text string on the title bar. Calls the constructor of this class that takes a Frame, a String, and a boolean as parameters. Passes the specified frame and title, along with a boolean value of true to the other constructor.

Parameters:

frame
The Frame for the dialog box.
title
A text string that appears on the title bar.

FontChooser(java.awt.Frame, java.lang.String, boolean)

  public FontChooser(Frame frame, String title, boolean modal)
Constructs a FontChooser with a specified parent frame, a string that appears as the title of the dialog box, and a boolean value that indicates whether the dialog is modal.

Parameters:

frame
The Frame for the dialog box.
title
A text string that appears on the title bar.
modal
If true the dialog is modal.

FontChooser properties

allowAnyFontSize

 public boolean isAllowAnyFontSize()
 public void setAllowAnyFontSize(boolean allowAnyFontSize)
Determines whether the user can enter any font size in the dialog box. If true, the Font Size combo box is editable, allowing the user to enter any font size; otherwise, only sizes in the drop-down list can be selected. The default value is true.

availableFonts

 public Font[] getAvailableFonts()
 public void setAvailableFonts(Font[] availableFonts)
Returns the list of font names displayed in the dialog box. Sets the list of font names displayed in the dialog box.

availableFontSizes

 public String[] getAvailableFontSizes()
 public void setAvailableFontSizes(String[] availableFontSizes)
Returns the list of font sizes displayed in the dialog box. Sets the list of font sizes displayed in the dialog box.

frame

 public Frame getFrame()
 public void setFrame(Frame frame)
Returns and sets the Frame used for the dialog box. The frame property must be set to a parent Frame before the dialog box is displayed.

modal

 public boolean isModal()
 public void setModal(boolean modal)
Returns whether the dialog box is modal or not. Sets whether the dialog box is modal or not.

sampleText

 public String getSampleText()
 public void setSampleText(String sampleText)
Returns and sets the string that appears as the sample text string in the dialog box so the user can see how choosing a font, font size, and style options affect the look of text. If this property is not set, a default sample string appears in the dialog box that includes letters, numbers, and punctuation symbols.

selectedFont

 public Font getSelectedFont()
 public void setSelectedFont(Font selectedFont)
Returns the font name the user selected in the dialog box and sets the selected font in the dialog box.

title

 public String getTitle()
 public void setTitle(String title)
Returns and sets the string that appears as the title of the dialog box on the title bar.

FontChooser methods

show()

  public void show()
Calls the showDialog() method. To determine whether the user entered a font and chose OK or canceled the dialog box, call showDialog() instead.

showDialog()

  public boolean showDialog()
Displays the font selection dialog box and returns true if the user selected a font and chose OK. If the frame property is null, an IllegalStateException is thrown.