Compare commits

..

No commits in common. "7605646b80107b5da9272c86cffef0d29f486976" and "864ca20e18ef014ac9e71f5ed7faad9db636e839" have entirely different histories.

1 changed files with 2 additions and 17 deletions

View File

@ -80,27 +80,13 @@ public class BoardDisplay extends JPanel {
// } // }
// }); // });
field.addMouseListener(new MouseAdapter() { field.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
if (currentShip != null) {
previewShipPlacement(x, y, horizontal);
}
}
@Override
public void mouseExited(MouseEvent e) {
if (currentShip != null) {
clearPreview();
}
}
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) { if (SwingUtilities.isRightMouseButton(e)) {
togglePlacementDirection(); togglePlacementDirection(); // Ausrichtung ändern
} else if (SwingUtilities.isLeftMouseButton(e)) { } else if (SwingUtilities.isLeftMouseButton(e)) {
Point o = new Point(x, y); Point o = new Point(x, y);
currentShip.setHorizontal(horizontal); handleFieldClick(o); // Linksklick -> Schiff platzieren
} }
} }
}); });
@ -195,7 +181,6 @@ public class BoardDisplay extends JPanel {
} }
public void refresh() { public void refresh() {
paintFields(); paintFields();
} }