Example usage for java.awt.event MouseEvent paramString

List of usage examples for java.awt.event MouseEvent paramString

Introduction

In this page you can find the example usage for java.awt.event MouseEvent paramString.

Prototype

@SuppressWarnings("deprecation")
public String paramString() 

Source Link

Document

Returns a parameter string identifying this event.

Usage

From source file:Main.java

public Main() {
    setLayout(null);/*from   www  .ja v  a  2 s  .  c  om*/
    add(button);
    button.setSize(button.getPreferredSize());
    button.setLocation(20, 20);
    addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent event) {
            System.out.println(event.paramString());
        }
    });
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Get the chosen Wrapper from the tree node that was clicked on.
 * /*from w  ww .java 2  s. c  o m*/
 * @param event
 *          The mouse click event
 * 
 * @return The Wrapper instance or null if the node is not a Wrapper
 */
private Wrapper getSelectedWrapperInTree(MouseEvent event) {
    Wrapper chosenWrapper = null;

    LOGGER.debug("Tree mouse event: " + event.paramString());
    final TreePath path = ontModelTree.getPathForLocation(event.getX(), event.getY());
    if (path != null) {
        LOGGER.debug("Tree right-mouse event on: " + path.getLastPathComponent() + " of class "
                + path.getLastPathComponent().getClass());
        if (path.getLastPathComponent() instanceof DefaultMutableTreeNode) {
            final DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) path.getLastPathComponent();
            final Object selectedObject = selectedNode.getUserObject();
            LOGGER.debug("Class of object in the selected tree node: " + selectedObject.getClass().getName());
            if (selectedObject instanceof Wrapper) {
                chosenWrapper = (Wrapper) selectedObject;
                LOGGER.debug("Wrapper found: " + selectedObject);
            }
        }
    }

    return chosenWrapper;
}