Makes sure all GUI windows have the same icon
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2021-09-30 17:47:12 +02:00
parent b021de5594
commit 50b9188229
2 changed files with 21 additions and 0 deletions

View File

@ -2,10 +2,14 @@ package net.knarcraft.minecraftserverlauncher.userinterface;
import net.knarcraft.minecraftserverlauncher.utility.BackupUtil;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import static net.knarcraft.minecraftserverlauncher.utility.CommonFunctions.getResourceAsStream;
/**
* The Backup GUI is used to display backup progress
@ -33,6 +37,13 @@ public class BackupGUI implements ActionListener {
frame = new JFrame("Running backup...");
frame.setBounds(100, 100, 500, 140);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
ImageIcon img;
try {
img = new ImageIcon(ImageIO.read(getResourceAsStream("GUIIcon.png")));
frame.setIconImage(img.getImage());
} catch (IOException ignored) {
}
progressTextArea = new JTextArea();
progressTextArea.setEditable(false);
progressBar = new JProgressBar();

View File

@ -1,7 +1,11 @@
package net.knarcraft.minecraftserverlauncher.userinterface;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
import static net.knarcraft.minecraftserverlauncher.utility.CommonFunctions.getResourceAsStream;
/**
* This class keeps track of all consoles
@ -31,6 +35,12 @@ public class ServerConsoles {
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
consolesTabbedPane = new JTabbedPane(JTabbedPane.TOP);
frame.getContentPane().add(consolesTabbedPane, BorderLayout.CENTER);
ImageIcon img;
try {
img = new ImageIcon(ImageIO.read(getResourceAsStream("GUIIcon.png")));
frame.setIconImage(img.getImage());
} catch (IOException ignored) {
}
}
}