diff --git a/img/misc/favicon.png b/img/misc/favicon.png new file mode 100644 index 0000000..73ed1d2 Binary files /dev/null and b/img/misc/favicon.png differ diff --git a/src/GameFrame.java b/src/GameFrame.java index 5f87182..f81bdab 100644 --- a/src/GameFrame.java +++ b/src/GameFrame.java @@ -34,6 +34,10 @@ public class GameFrame extends JFrame{ } this.add(game); this.setTitle("GUI is cool!"); //set title for frame + // set game icon and ignore exception (failing to set icon doesn't otherwise break program) + try { + this.setIconImage(GamePanel.getImage("img/misc/favicon.png")); + } catch (IOException ignored) {} this.setResizable(false); //frame can't change size this.setBackground(Color.white); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //X button will stop program execution diff --git a/src/GamePanel.java b/src/GamePanel.java index eae9433..aa462ff 100644 --- a/src/GamePanel.java +++ b/src/GamePanel.java @@ -187,11 +187,11 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{ } - public BufferedImage getImage(String imageLocation) throws IOException { + public static BufferedImage getImage(String imageLocation) throws IOException { return ImageIO.read(new File(imageLocation)); } - public BufferedImage flipImageHorizontally(BufferedImage originalImage) { + public static BufferedImage flipImageHorizontally(BufferedImage originalImage) { BufferedImage flippedImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB); for (int x = 0; x < originalImage.getWidth(); x++) { for (int y = 0; y < originalImage.getHeight(); y++) {