From 573518d14b6afedc56b326d041348b3b59c37e0d Mon Sep 17 00:00:00 2001 From: ericnerdo Date: Sat, 7 May 2016 14:40:52 +0200 Subject: [PATCH] Heirs of ImagePanel now throw IOException. --- cicaprojekt/FieldDrawer.java | 4 +++- cicaprojekt/GapDrawer.java | 4 +++- cicaprojekt/ImagePanel.java | 7 ++----- cicaprojekt/WallDrawer.java | 4 +++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cicaprojekt/FieldDrawer.java b/cicaprojekt/FieldDrawer.java index 0d1fc7b..76301a3 100644 --- a/cicaprojekt/FieldDrawer.java +++ b/cicaprojekt/FieldDrawer.java @@ -1,10 +1,12 @@ package cicaprojekt; +import java.io.IOException; + public class FieldDrawer extends ImagePanel implements Drawer { Field field; - public FieldDrawer(Field f) { + public FieldDrawer(Field f) throws IOException { super("Field.png"); field = f; setVisible(false); diff --git a/cicaprojekt/GapDrawer.java b/cicaprojekt/GapDrawer.java index 9a7e370..b5248a5 100644 --- a/cicaprojekt/GapDrawer.java +++ b/cicaprojekt/GapDrawer.java @@ -1,10 +1,12 @@ package cicaprojekt; +import java.io.IOException; + public class GapDrawer extends ImagePanel implements Drawer{ private Gap gap; - public GapDrawer(Gap g) { + public GapDrawer(Gap g) throws IOException { super("Gap.png"); gap = g; setVisible(false); diff --git a/cicaprojekt/ImagePanel.java b/cicaprojekt/ImagePanel.java index 2085226..d7fd475 100644 --- a/cicaprojekt/ImagePanel.java +++ b/cicaprojekt/ImagePanel.java @@ -12,11 +12,8 @@ public class ImagePanel extends JPanel{ private BufferedImage image; - public ImagePanel(String path) { - try { - image = ImageIO.read(new File(path)); - } catch (IOException ex) { - } + public ImagePanel(String path) throws IOException { + image = ImageIO.read(new File(path)); } @Override diff --git a/cicaprojekt/WallDrawer.java b/cicaprojekt/WallDrawer.java index ef16c78..f5202a9 100644 --- a/cicaprojekt/WallDrawer.java +++ b/cicaprojekt/WallDrawer.java @@ -1,10 +1,12 @@ package cicaprojekt; +import java.io.IOException; + public class WallDrawer extends ImagePanel implements Drawer { Wall wall; - public WallDrawer(Wall w) { + public WallDrawer(Wall w) throws IOException { super("Wall.png"); wall = w; setVisible(false);