Example usage for javax.swing JTextArea addMouseMotionListener

List of usage examples for javax.swing JTextArea addMouseMotionListener

Introduction

In this page you can find the example usage for javax.swing JTextArea addMouseMotionListener.

Prototype

public synchronized void addMouseMotionListener(MouseMotionListener l) 

Source Link

Document

Adds the specified mouse motion listener to receive mouse motion events from this component.

Usage

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400, 400);/*from   ww  w. j  ava 2s  . c  o m*/

    JTextArea textArea = new JTextArea("drag it...");
    textArea.addMouseMotionListener(new MouseMotionAdapter() {
        public void mouseDragged(MouseEvent e) {
            System.out.println("Mouse Dragged...");
        }

        public void mouseMoved(MouseEvent e) {
            System.out.println("Mouse Moved...");
        }
    });

    getContentPane().add(textArea);
}