Example usage for org.jfree.ui FontChooserPanel getSelectedFont

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

Introduction

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

Prototype

public Font getSelectedFont() 

Source Link

Document

Returns a Font object representing the selection in the panel.

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());
    }//from   w ww  .j  a v a2s.  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.
 */// www  .ja va  2 s. c om
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());
    }

}