Methods | This Package | All Packages
Represents a common dialog box that displays a list of fonts that are currently installed on the system.
Component
|
+--CommonDialog
|
+--FontDialog
package com.ms.wfc.ui
public class FontDialog
extends CommonDialog
Remarks
The user can select a particular font from the list, and this selection is then reported back to the application. Use the showDialog method to show the dialog box. Use the getFont method to get the font the user selected.
The following example opens a Font dialog box and set the font for the form to the font the user selects:
private void btnFont_click(Object source, Event e)
{
FontDialog fd = new FontDialog();
fd.setFont(Font.SYSTEM); //sets the font that is selected when the dialog box opens
int dlgResult = fd.showDialog();
if (dlgResult == DialogResult.OK) {
Font font = fd.getFont(); //gets the font the user chose
this.setFont(font); //sets the form font to the chosen font
}
}