Example usage for java.awt.event MouseEvent getMouseModifiersText

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

Introduction

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

Prototype

@SuppressWarnings("deprecation")
public static String getMouseModifiersText(int modifiers) 

Source Link

Document

Returns a String instance describing the modifier keys and mouse buttons that were down during the event, such as "Shift", or "Ctrl+Shift".

Usage

From source file:Main.java

public Main() {
    setLayout(null);//from  ww w.j  a  va2 s .  c om
    add(button);
    button.setSize(button.getPreferredSize());
    button.setLocation(20, 20);
    addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent event) {
            System.out.println(MouseEvent.getMouseModifiersText(event.getModifiers()));
        }
    });
}