Recognize double clicks made in rapid succession

Currently they are not recognized, because getClickCount() will be
higher than 2 since Java interprets them as quadruple, sextuple, etc. clicks.

So, instead of checking for getClickCount() == 2, check for getClickCount()
being an even number.

This allows to quickly remove or add many cards to a deck.
This commit is contained in:
draxdyn 2016-06-01 16:42:22 +02:00
parent a9744b2d04
commit 0b8404f0a4
5 changed files with 6 additions and 6 deletions

View file

@ -308,7 +308,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
// End of variables declaration//GEN-END:variables
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 && !e.isConsumed()) {
if ((e.getClickCount() & 1) == 0 && (e.getClickCount() > 0) && !e.isConsumed()) { // double clicks and repeated double clicks
e.consume();
Object obj = e.getSource();
if (obj instanceof Card) {