Example usage for javax.swing JOptionPane setFont

List of usage examples for javax.swing JOptionPane setFont

Introduction

In this page you can find the example usage for javax.swing JOptionPane setFont.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.")
public void setFont(Font font) 

Source Link

Document

Sets the font for this component.

Usage

From source file:JOptionPaneDemonstrationLocalized.java

public static void main(String[] argv) {

        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Font unicodeFont = new Font("LucidaSans", Font.PLAIN, 12);

        ResourceBundle bundle = ResourceBundle.getBundle("JOptionPaneResources", Locale.getDefault());

        String[] textMessages = new String[3];
        textMessages[0] = bundle.getString("Yes");
        textMessages[1] = bundle.getString("No");
        textMessages[2] = bundle.getString("Cancel");

        JOptionPane jop = new JOptionPane(bundle.getString("MessageText"), JOptionPane.ERROR_MESSAGE,
                JOptionPane.YES_NO_CANCEL_OPTION, null, textMessages);
        JDialog jopDialog = jop.createDialog(null, bundle.getString("TitleText"));
        jop.setFont(unicodeFont);
        jopDialog.setVisible(true);/*from  www  .  j  a  va  2  s.  c om*/
        Object userSelection = jop.getValue();
    }