From 96c3adba83cfadd131328150a380000fc6d9e4bc Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Sat, 7 May 2016 16:08:25 +0200 Subject: [PATCH] GateDrawer.java added. --- cicaprojekt/GateDrawer.java | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cicaprojekt/GateDrawer.java diff --git a/cicaprojekt/GateDrawer.java b/cicaprojekt/GateDrawer.java new file mode 100644 index 0000000..1a1d730 --- /dev/null +++ b/cicaprojekt/GateDrawer.java @@ -0,0 +1,35 @@ +package cicaprojekt; + +import java.io.IOException; + +public class GateDrawer extends ImagePanel implements Drawer{ + + Gate gate; + + public GateDrawer(Gate g) throws IOException { + super("ClosedGate.png"); + gate = g; + setVisible(false); + } + + @Override + public void draw() throws IOException { + if(gate.isOpen()) + changeImage("OpenGate.png"); + else + changeImage("ClosedGate.png"); + + setVisible(true); + } + + @Override + public int getX() { + return gate.getX(); + } + + @Override + public int getY() { + return gate.getY(); + } + +}