aboutsummaryrefslogtreecommitdiff
path: root/PunchingBag/src/PunchingBagGUI.java
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2011-09-05 23:09:28 +0100
committerChristopher Baines <cbaines8@gmail.com>2011-09-05 23:09:28 +0100
commitcfa29ad09cc9974a0a55e5b25bcc5f59a71d5950 (patch)
treeb23fd38e736f1ac81259a2ee9afa56105d9c93c6 /PunchingBag/src/PunchingBagGUI.java
parentfcd9bda1916ee874b843ae257ba9ac1a75a63c07 (diff)
downloadpunchingbag-cfa29ad09cc9974a0a55e5b25bcc5f59a71d5950.tar
punchingbag-cfa29ad09cc9974a0a55e5b25bcc5f59a71d5950.tar.gz
Improved the Effect API, threading and display.
Diffstat (limited to 'PunchingBag/src/PunchingBagGUI.java')
-rw-r--r--PunchingBag/src/PunchingBagGUI.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/PunchingBag/src/PunchingBagGUI.java b/PunchingBag/src/PunchingBagGUI.java
index f3997a8..1db9d68 100644
--- a/PunchingBag/src/PunchingBagGUI.java
+++ b/PunchingBag/src/PunchingBagGUI.java
@@ -56,15 +56,6 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener,
bag.addButtonListener(this);
bag.addLEDChangeListener(this);
-
- draw();
- }
-
- void draw() throws InterruptedException {
- bagSimFrame.paintComponents(bagSimFrame.getGraphics());
- // bagSimFrame.paintAll(bagSimFrame.getGraphics());
- Thread.sleep(50);
- draw();
}
public void runInteractively(Contact contact) {
@@ -133,10 +124,12 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener,
} else if (bag.getLED(x, y) == PunchingBag.Colour.Green) {
g.setColor(Color.green);
g.fillOval(40 * x, 40 * y, 6, 6);
- }
- if (bag.getLED(x, y) == PunchingBag.Colour.Yellow) {
+ } else if (bag.getLED(x, y) == PunchingBag.Colour.Yellow) {
g.setColor(Color.yellow);
g.fillOval(40 * x, 40 * y, 6, 6);
+ } else {
+ g.setColor(Color.white);
+ g.fillOval(40 * x, 40 * y, 6, 6);
}
}
}