@Override
    public void mousePressed(MouseEvent e) {
        final TCard source = (TCard) e.getSource();
        if (e.getButton() == MouseEvent.BUTTON1) {
            tempCard = source;
            tempX = e.getX();
            tempY = e.getY();
            cardPosition = source.getCardPosition();
            if (e.getClickCount() == 2) {
                if (source.isTapped()) {
                    source.untap();
                    Game.client.send(new TapCard(source.getID(), false));
                } else {
                    source.tap();
                    Game.client.send(new TapCard(source.getID(), true));
                }
            }
        } else {
            tempCard = null;
        }
        if (e.getButton() == MouseEvent.BUTTON3) {
            if (e.getClickCount() == 1) {
                JPopupMenu popupMenu = new JPopupMenu();

                JMenuItem exile = new JMenuItem("exile");
                exile.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Game.client.send(new MoveCard(Zone.TABLE, Zone.EXILED,
                                -1, source.getID()));
                    }
                });

                JMenuItem moveToHand = new JMenuItem("return to hand");
                moveToHand.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Game.client.send(new MoveCard(
                                Zone.TABLE, Zone.HAND, -1, source.getID()));
                    }
                });

                JMenuItem moveToGraveyard = new JMenuItem("destroy");
                moveToGraveyard.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Game.client.send(new MoveCard(Zone.TABLE,
                                Zone.GRAVEYARD, -1, source.getID()));
                    }
                });

                JMenuItem moveToLibrary = new JMenuItem("put on top of library");
                moveToLibrary.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Game.client.send(new MoveCard(
                                Zone.TABLE, Zone.TOP_LIBRARY, -1, source.getID()));
                    }
                });

                popupMenu.add(moveToGraveyard);
                popupMenu.add(moveToHand);
                popupMenu.add(moveToLibrary);
                popupMenu.add(exile);

                popupMenu.show(source, e.getX(), e.getY());
            }
        }
    }