Java Swing Mouse createButton(JComponent parent, String description, MouseListener listener)

Here you can find the source of createButton(JComponent parent, String description, MouseListener listener)

Description

Creates a button with the given description text.

License

Open Source License

Declaration

public static JButton createButton(JComponent parent, String description, MouseListener listener) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Main {
    /**//from   www .  ja v  a 2  s.  com
     * Creates a button with the given description text.
     */
    public static JButton createButton(JComponent parent, String description, MouseListener listener) {
        JButton button = new JButton(description);
        button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        button.addMouseListener(listener);
        parent.add(button);
        return button;
    }
}

Related

  1. convert(MouseEvent event, Component newSource)
  2. convertMouseEvent(Component source, MouseEvent sourceEvent, Component destination)
  3. convertMouseEvent(Component source, MouseEvent sourceEvent, Component destination)
  4. convertMouseEvent(java.awt.Component source, java.awt.event.MouseEvent sourceEvent, java.awt.Component destination)
  5. convertPoint(MouseEvent evt, Component target)
  6. decorateComponentWithMouseOverCursorChange(final JComponent toDecorate, final int mouseEntered, final int mouseExited)
  7. delegateEventToParent(Component component, MouseEvent e)
  8. disableDoubleMouseClick(Component c)
  9. forwardMouseWheelEvent(JScrollPane target, MouseWheelEvent evt)