Example usage for org.jfree.ui FontChooserPanel FontChooserPanel

List of usage examples for org.jfree.ui FontChooserPanel FontChooserPanel

Introduction

In this page you can find the example usage for org.jfree.ui FontChooserPanel FontChooserPanel.

Prototype

public FontChooserPanel(final Font font) 

Source Link

Document

Standard constructor - builds a FontChooserPanel initialised with the specified font.

Usage

From source file:org.jfree.chart.demo.DrawStringDemo.java

private void displayFontDialog() {
    FontChooserPanel fontchooserpanel = new FontChooserPanel(drawStringPanel1.getFont());
    int i = JOptionPane.showConfirmDialog(this, fontchooserpanel, "Font Selection", 2, -1);
    if (i == 0) {
        drawStringPanel1.setFont(fontchooserpanel.getSelectedFont());
        drawStringPanel2.setFont(fontchooserpanel.getSelectedFont());
    }/* w  w w.j av  a 2s.c o m*/
}

From source file:org.jfree.demo.DrawStringDemo.java

/**
 * Displays a primitive font chooser dialog to allow the user to change the font.
 *///w w w .j a v a  2 s . c  o m
private void displayFontDialog() {

    final FontChooserPanel panel = new FontChooserPanel(this.drawStringPanel1.getFont());
    final int result = JOptionPane.showConfirmDialog(this, panel, "Font Selection",
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);

    if (result == JOptionPane.OK_OPTION) {
        this.drawStringPanel1.setFont(panel.getSelectedFont());
        this.drawStringPanel2.setFont(panel.getSelectedFont());
    }

}