void changeImage(String path) added to ImagePanel.

This commit is contained in:
ericnerdo 2016-05-07 14:45:58 +02:00
parent 573518d14b
commit 1c847c06ae
2 changed files with 6 additions and 1 deletions

View File

@ -22,4 +22,8 @@ public class ImagePanel extends JPanel{
g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
}
public void changeImage(String path) throws IOException {
image = ImageIO.read(new File(path));
repaint();
}
}

View File

@ -14,6 +14,7 @@ public class WallDrawer extends ImagePanel implements Drawer {
@Override
public void draw() {
setVisible(true);
}