diff options
Diffstat (limited to 'src/jrummikub/view/impl')
-rw-r--r-- | src/jrummikub/view/impl/AbstractStonePanel.java | 26 | ||||
-rw-r--r-- | src/jrummikub/view/impl/TablePanel.java | 3 |
2 files changed, 21 insertions, 8 deletions
diff --git a/src/jrummikub/view/impl/AbstractStonePanel.java b/src/jrummikub/view/impl/AbstractStonePanel.java index 82bc7b7..175f2df 100644 --- a/src/jrummikub/view/impl/AbstractStonePanel.java +++ b/src/jrummikub/view/impl/AbstractStonePanel.java @@ -63,7 +63,7 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel, @Override public void mouseClicked(MouseEvent e) { clickAt(e.getPoint(), e.getClickCount(), e.isShiftDown(), - e.isControlDown()); + e.isControlDown(), e.isAltDown()); } @Override @@ -86,19 +86,31 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel, } /** - * clickAt is called when a click has occured + * clickAt is called when a click has occurred * - * @param p the point in component coordinates - * @param clickCount the click count - * @param shift is shift down? - * @param control is control down? + * @param p + * the point in component coordinates + * @param clickCount + * the click count + * @param shift + * is shift down? + * @param control + * is control down? + * @param alt + * is alt down? */ - protected void clickAt(Point p, int clickCount, boolean shift, boolean control) { + protected void clickAt(Point p, int clickCount, boolean shift, + boolean control, boolean alt) { Insets insets = getInsets(); Pair<Integer, Integer> trans = getTranslation(); Position pos = stonePainter.calculatePosition( p.x - insets.left - trans.getFirst(), p.y - insets.top - trans.getSecond()); + if (alt) { + clickEvent.emit(pos); + return; + } + Stone stone = getStoneAt(pos); if (stone == null) { diff --git a/src/jrummikub/view/impl/TablePanel.java b/src/jrummikub/view/impl/TablePanel.java index dfca389..4b385d3 100644 --- a/src/jrummikub/view/impl/TablePanel.java +++ b/src/jrummikub/view/impl/TablePanel.java @@ -156,7 +156,8 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { public void handle(Point p) { Point p2 = SwingUtilities.convertPoint(stoneCollection, p, TablePanel.this); - clickAt(p2, 1, false, false); + // theres nothing below here + clickAt(p2, 1, false, false, true); } }); add(stoneCollection); |