How do I get mouse number of buttons?

Category: java.awt, viewed: 1105 time(s).

MouseInfo provides methods for getting information about the mouse, such as mouse pointer location and the number of mouse buttons.

package org.kodejava.example.awt;

import java.awt.*;

public class MouseNumberOfButtons {
    public static void main(String[] args) {
        //
        // Get the number of buttons on the mouse. On systems without a
        // mouse, returns -1. HeadlessException if
        // GraphicsEnvironment.isHeadless() returns true
        //
        int numberOfButtons = MouseInfo.getNumberOfButtons();
        System.out.println("Mouse Number Of Buttons = " + numberOfButtons);
    }
}
Click here to lend your support to: Kode Java Org and make a donation at www.pledgie.com !

 

Can't find what you are looking for? Join our FORUMS and ask some questions!
Download Hundreds of Complimentary Industry Resources

Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more; all available at no cost to you. With more than 600 complimentary offers, you'll find plenty of titles to suit your professional interests and needs. Click Here and Sign up today!

Sponsored Links

Our Friends

Statistics

Locations of visitors to this page
visitor stats