Check for a behavior change on MouseEvent getButton method

This rule flags instances of the java.awt.event.MouseEvent getButton() method.

This method is flagged because there is a behavior change associated with it. According to Java SE 7 and JDK 7 Compatibility documentation, the method used to return an int value between [0-3] range that represented the mouse buttons or the scroll wheel action. To accommodate newer models of mice devices with more than one scroll wheel, or with more than three buttons, the method now returns an int value from 0 to the number of buttons.

The user needs to evaluate the code and determine if it is affected by the behavior change, pursue any appropriate testing, and make any necessary changes to the code.

According to the documentation, the user can preserve the older behavior of JDK 6 by setting the property sun.awt.enableExtraMouseButtons to false.

For additional information, see the Java 7 API: