/** * Shows a modal font-chooser dialog and blocks until the dialog is hidden. If the user presses * the "OK" button, then this method hides/disposes the dialog and returns the selected color. If * the user presses the "Cancel" button or closes the dialog without pressing "OK", then this * method hides/disposes the dialog and returns <code>null</code>. * * @param parent the parent <code>Component</code> for the dialog * @param title the String containing the dialog's title * @return the selected font or <code>null</code> if the user opted out * @throws java.awt.HeadlessException if GraphicsEnvironment.isHeadless() returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ public Font showFontDialog(Component parent, String title) { BaseDialog dialog = createDialog(parent, title); if (dialog.ask()) { return getSelectedFont(); } else { return null; } }