Example usage for javax.swing JDialog setFont

List of usage examples for javax.swing JDialog setFont

Introduction

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

Prototype

public void setFont(Font f) 

Source Link

Document

Sets the font of this container.

Usage

From source file:es.emergya.ui.base.Message.java

private void inicializar(final String texto) {
    log.trace("inicializar(" + texto + ")");
    final Message message_ = this;

    SwingUtilities.invokeLater(new Runnable() {

        @Override//from ww w . j  ava  2 s  . c o m
        public void run() {
            log.trace("Sacamos un nuevo mensaje: " + texto);
            JDialog frame = new JDialog(window.getFrame(), true);
            frame.setUndecorated(true);
            frame.getContentPane().setBackground(Color.WHITE);
            frame.setLocation(150, window.getHeight() - 140);
            frame.setSize(new Dimension(window.getWidth() - 160, 130));
            frame.setName("Incoming Message");
            frame.setBackground(Color.WHITE);
            frame.getRootPane().setBorder(new MatteBorder(4, 4, 4, 4, color));

            frame.setLayout(new BorderLayout());
            if (font != null)
                frame.setFont(font);

            JLabel icon = new JLabel(new ImageIcon(this.getClass().getResource("/images/button-ok.png")));
            icon.setToolTipText("Cerrar");

            icon.removeMouseListener(null);
            icon.addMouseListener(new Cerrar(frame, message_));

            JLabel text = new JLabel(texto);
            text.setBackground(Color.WHITE);
            text.setForeground(Color.BLACK);
            frame.add(text, BorderLayout.WEST);
            frame.add(icon, BorderLayout.EAST);

            frame.setVisible(true);
        }
    });
}