Example usage for javax.swing JLabel removeMouseListener

List of usage examples for javax.swing JLabel removeMouseListener

Introduction

In this page you can find the example usage for javax.swing JLabel removeMouseListener.

Prototype

public synchronized void removeMouseListener(MouseListener l) 

Source Link

Document

Removes the specified mouse listener so that it no longer receives mouse events from this component.

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  w ww.  j  a  v  a  2s.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);
        }
    });
}

From source file:com.haulmont.cuba.desktop.sys.DesktopToolTipManager.java

/**
 * Register tooltip for {@link javax.swing.JLabel}.
 * Tooltip is displayed when the user hovers over a label
 * ToolTip text is taken from {@link javax.swing.JComponent#getToolTipText()}.
 *
 * @param lbl Label to register// w w w. j  a va 2s.  c  o  m
 */
public void registerTooltip(final JLabel lbl) {
    lbl.removeMouseListener(componentMouseListener);
    lbl.addMouseListener(componentMouseListener);
}