From ec6fa4784aac8273bb39e92e83e061dc392d55e7 Mon Sep 17 00:00:00 2001 From: Anton Johansson Date: Mon, 12 Jan 2009 15:08:29 +0100 Subject: [PATCH] mouseClicked changed to mouseReleased to prevent clicks loosing click by moving mouse --- src/se/umu/cs/dit06ajnajs/ATDController.java | 2 +- .../cs/dit06ajnajs/level/MapSquarePrototypeFactory.java | 15 +++++++-------- src/se/umu/cs/dit06ajnajs/util/LevelEditor.java | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/se/umu/cs/dit06ajnajs/ATDController.java b/src/se/umu/cs/dit06ajnajs/ATDController.java index 8ea609d..4fbb0cd 100644 --- a/src/se/umu/cs/dit06ajnajs/ATDController.java +++ b/src/se/umu/cs/dit06ajnajs/ATDController.java @@ -403,7 +403,7 @@ public class ATDController { private class MapListener extends MouseAdapter { @Override - public void mouseClicked(MouseEvent me) { + public void mouseReleased(MouseEvent me) { clickPoint(me.getX(), me.getY()); // TODO, only update what is needed. view.updateBackgroundImage(); diff --git a/src/se/umu/cs/dit06ajnajs/level/MapSquarePrototypeFactory.java b/src/se/umu/cs/dit06ajnajs/level/MapSquarePrototypeFactory.java index 5033799..e95be4b 100644 --- a/src/se/umu/cs/dit06ajnajs/level/MapSquarePrototypeFactory.java +++ b/src/se/umu/cs/dit06ajnajs/level/MapSquarePrototypeFactory.java @@ -53,33 +53,32 @@ public class MapSquarePrototypeFactory { // Create TowerSquare Prototype // URL url = this.getClass().getResource("/resources/grass.jpg"); - URL url = new URL(imagesURL, "grass.jpg"); + URL url = new URL(imagesURL, "TowerSquare.jpg"); BufferedImage image = ImageIO.read(url); squareMap.put("TowerSquare", new TowerSquare(-1, -1, image)); // Create PathSquare Prototype - url = new URL(imagesURL, "path.jpg"); + url = new URL(imagesURL, "PathSquare.jpg"); image = ImageIO.read(url); squareMap.put("PathSquare", new PathSquare(-1, -1, image)); // Create GoalSquare Prototype - url = new URL(imagesURL, "goal.gif"); + url = new URL(imagesURL, "GoalSquare.gif"); image = ImageIO.read(url); squareMap.put("GoalSquare", new GoalSquare(-1, -1, image)); - - // Create GoalSquare Prototype - url = new URL(imagesURL, "start.gif"); + // Create StartSquare Prototype + url = new URL(imagesURL, "StartSquare.gif"); image = ImageIO.read(url); squareMap.put("StartSquare", new StartSquare(-1, -1, image)); // Create BlockedSquare Prototype - url = new URL(imagesURL, "stone.gif"); + url = new URL(imagesURL, "BlockedSquare.gif"); image = ImageIO.read(url); squareMap.put("BlockedSquare", new BlockedSquare(-1, -1, image)); // Create TurSquare Prototype - url = new URL(imagesURL, "turnpath.gif"); + url = new URL(imagesURL, "TurnSquare.gif"); image = ImageIO.read(url); // TODO: TurnSquare squareMap.put("TurnSquare", new TurnSquare(-1, -1, image)); diff --git a/src/se/umu/cs/dit06ajnajs/util/LevelEditor.java b/src/se/umu/cs/dit06ajnajs/util/LevelEditor.java index 0acf3b6..9060096 100644 --- a/src/se/umu/cs/dit06ajnajs/util/LevelEditor.java +++ b/src/se/umu/cs/dit06ajnajs/util/LevelEditor.java @@ -149,7 +149,7 @@ public class LevelEditor extends JFrame { */ private class MapListener extends MouseAdapter { @Override - public void mouseClicked(MouseEvent me) { + public void mouseReleased(MouseEvent me) { int x = me.getX(); int y = me.getY(); MapSquare square = level.getMapSquareAtPoint(x, y); -- 2.11.4.GIT