Added favicon, made classes static

master
John 2022-06-03 13:09:59 -04:00
parent 99619a2bc9
commit 3faddb790a
3 changed files with 6 additions and 2 deletions

BIN
img/misc/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -34,6 +34,10 @@ public class GameFrame extends JFrame{
} }
this.add(game); this.add(game);
this.setTitle("GUI is cool!"); //set title for frame 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.setResizable(false); //frame can't change size
this.setBackground(Color.white); this.setBackground(Color.white);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //X button will stop program execution this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //X button will stop program execution

View File

@ -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)); 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); BufferedImage flippedImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
for (int x = 0; x < originalImage.getWidth(); x++) { for (int x = 0; x < originalImage.getWidth(); x++) {
for (int y = 0; y < originalImage.getHeight(); y++) { for (int y = 0; y < originalImage.getHeight(); y++) {