All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fontchooser-example.2.4.source-code.DialogExample Maven / Gradle / Ivy

The newest version!
import org.drjekyll.fontchooser.FontDialog;

import javax.swing.*;
import java.awt.Frame;
import java.lang.reflect.InvocationTargetException;

public class DialogExample implements Runnable {

    public static void main(String[] args) throws InvocationTargetException, InterruptedException {
        ExampleRunner.useLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        ExampleRunner.invoke(new DialogExample());
    }

    @Override
    public void run() {
        FontDialog dialog = new FontDialog((Frame) null, "Select Font", true);
        dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        dialog.setVisible(true);
        if (!dialog.isCancelSelected()) {
            System.out.printf("Selected font is: %s%n", dialog.getSelectedFont());
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy