summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/AbstractStonePanel.java
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-21 15:23:29 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-21 15:23:29 +0200
commit7899a38fe63a819d405a18e0139cea6ff95aac33 (patch)
tree559c4f4f80f0fad9548bb31673be9e89c70b72c5 /src/jrummikub/view/impl/AbstractStonePanel.java
parente4e66240bf864354715f3812f70444d7f7511dd2 (diff)
downloadJRummikub-7899a38fe63a819d405a18e0139cea6ff95aac33.tar
JRummikub-7899a38fe63a819d405a18e0139cea6ff95aac33.zip
Noch mehr Kommentare, z.B. alle Methoden im Model und in der IView
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@547 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/AbstractStonePanel.java')
-rw-r--r--src/jrummikub/view/impl/AbstractStonePanel.java39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/jrummikub/view/impl/AbstractStonePanel.java b/src/jrummikub/view/impl/AbstractStonePanel.java
index ba3013c..6f8e06c 100644
--- a/src/jrummikub/view/impl/AbstractStonePanel.java
+++ b/src/jrummikub/view/impl/AbstractStonePanel.java
@@ -52,7 +52,7 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
* Create a new StonePanel with a given scale factor
*
* @param scale
- * the grid scale
+ * the grid scale
*/
public AbstractStonePanel(float scale) {
super(true); // Set double buffered
@@ -77,8 +77,9 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
public void mouseMoved(MouseEvent e) {
Insets insets = getInsets();
Pair<Integer, Integer> trans = getTranslation();
- Position pos = stonePainter.calculatePosition(e.getX() - insets.left
- - trans.getFirst(), e.getY() - insets.top - trans.getSecond());
+ Position pos = stonePainter.calculatePosition(e.getX()
+ - insets.left - trans.getFirst(), e.getY() - insets.top
+ - trans.getSecond());
setHoveredStone(getStoneAt(pos));
@@ -91,15 +92,15 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
* clickAt is called when a click has occurred
*
* @param p
- * the point in component coordinates
+ * the point in component coordinates
* @param clickCount
- * the click count
+ * the click count
* @param shift
- * is shift down?
+ * is shift down?
* @param control
- * is control down?
+ * is control down?
* @param alt
- * is alt down?
+ * is alt down?
*/
protected void clickAt(Point p, int clickCount, boolean shift,
boolean control, boolean alt) {
@@ -132,6 +133,12 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
event.emit(stone, control);
}
+ /**
+ * Sets the stone over which the cursor hovers
+ *
+ * @param stone
+ * stone under cursor
+ */
private void setHoveredStone(Stone stone) {
Stone oldStone = hoveredStone;
hoveredStone = stone;
@@ -153,7 +160,7 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
* Overwrite this method to signal if special zone was clicked
*
* @param pos
- * the clicked position
+ * the clicked position
*
* @return special zone clicked
*/
@@ -165,11 +172,18 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
* Overwrite this method to signal if special zone was hovered
*
* @param pos
- * the hovered position
+ * the hovered position
*/
protected void handleOtherMoveEvent(Position pos) {
}
+ /**
+ * Gets the stone at the specified position
+ *
+ * @param pos
+ * position
+ * @return the stone
+ */
private Stone getStoneAt(Position pos) {
for (Pair<Stone, Position> entry : stones) {
Stone stone = entry.getFirst();
@@ -187,14 +201,15 @@ abstract class AbstractStonePanel extends JPanel implements IStonePanel,
* Sets the list of stones that can be clicked on
*
* @param stones
- * the stones and positions
+ * the stones and positions
*/
protected void setStones(Iterable<Pair<Stone, Position>> stones) {
this.stones = stones;
}
/**
- * Returns the translation in pixels the stones in this panel are painted with
+ * Returns the translation in pixels the stones in this panel are painted
+ * with
*
* @return the translation
*/