summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/AbstractStonePanel.java
diff options
context:
space:
mode:
authorBennet Gerlach <bennet_gerlach@web.de>2011-05-10 02:10:30 +0200
committerBennet Gerlach <bennet_gerlach@web.de>2011-05-10 02:10:30 +0200
commit9c056cfef76e310d049e718f0795771ca4cda678 (patch)
treed152ac2262e6f3ed0627055c41006739c8087a7c /src/jrummikub/view/impl/AbstractStonePanel.java
parent201c40a399ffd238cefe1305a57f52796e21cb0a (diff)
downloadJRummikub-9c056cfef76e310d049e718f0795771ca4cda678.tar
JRummikub-9c056cfef76e310d049e718f0795771ca4cda678.zip
Implemented direct placing of stones via alt-key
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@209 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/AbstractStonePanel.java')
-rw-r--r--src/jrummikub/view/impl/AbstractStonePanel.java26
1 files changed, 19 insertions, 7 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) {