I have code similar to the following:
JComponent component = ...
component.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
final int button = e.getButton();
System.out.println("button = " + button);
}
});
I received a crash report today that was caused because e.getButton() returned 0, which is NO_BUTTON. What might be a cause? How can a mouse click be on no button?
This happened on Java 1.5.0_30 on Mac OS X 10.5.8.
The code in question has been in production for 4 years, with thousands of daily users, and this is the first time this error has appeared in a crash report.