Skip to content

Commit 6f5bb7c

Browse files
committed
added icon to all windows
1 parent 58204d8 commit 6f5bb7c

File tree

10 files changed

+32
-1
lines changed

10 files changed

+32
-1
lines changed

src/main/java/lol/hyper/customlauncher/Main.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@
2929
import org.json.JSONArray;
3030
import org.json.JSONObject;
3131

32+
import javax.imageio.ImageIO;
3233
import javax.swing.*;
34+
import java.awt.*;
35+
import java.io.File;
36+
import java.io.FileInputStream;
3337
import java.io.IOException;
38+
import java.io.InputStream;
3439
import java.nio.file.Files;
3540
import java.nio.file.Paths;
3641
import java.util.Properties;
@@ -40,6 +45,7 @@ public class Main {
4045
public static String VERSION;
4146
public static Logger logger;
4247
public static String pathToUse;
48+
public static Image icon;
4349

4450
public static void main(String[] args) throws IOException {
4551
System.setProperty("log4j.configurationFile", "log4j2config.xml");
@@ -55,6 +61,11 @@ public static void main(String[] args) throws IOException {
5561
}
5662
boolean runSetup = false;
5763

64+
InputStream iconStream = Main.class.getResourceAsStream("/icon.png");
65+
if (iconStream != null) {
66+
icon = ImageIO.read(iconStream);
67+
}
68+
5869
// create the default files
5970
// config.json with default values
6071
// accounts.json with no accounts
@@ -121,7 +132,6 @@ public static void main(String[] args) throws IOException {
121132
}
122133
}
123134
}
124-
125135
JFrame mainWindow = new MainWindow("CustomLauncherRewrite", new InvasionTracker());
126136
mainWindow.dispose();
127137
}

src/main/java/lol/hyper/customlauncher/accounts/windows/AccountManagerWindow.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package lol.hyper.customlauncher.accounts.windows;
1919

20+
import lol.hyper.customlauncher.Main;
21+
2022
import javax.swing.*;
2123

2224
public class AccountManagerWindow extends JFrame {
@@ -32,6 +34,7 @@ public AccountManagerWindow(String title) {
3234
} catch (Exception ex) {
3335
ex.printStackTrace();
3436
}
37+
frame.setIconImage(Main.icon);
3538

3639
// GUI elements
3740
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/accounts/windows/DeleteAccountWindow.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.accounts.windows;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.accounts.Account;
2122
import lol.hyper.customlauncher.accounts.JSONManager;
2223

@@ -40,6 +41,7 @@ public DeleteAccountWindow(String title) {
4041
} catch (Exception ex) {
4142
ex.printStackTrace();
4243
}
44+
frame.setIconImage(Main.icon);
4345

4446
// GUI elements
4547
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/accounts/windows/MainWindow.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.accounts.windows;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.accounts.Account;
2122
import lol.hyper.customlauncher.accounts.JSONManager;
2223
import lol.hyper.customlauncher.invasiontracker.InvasionTracker;
@@ -43,6 +44,7 @@ public MainWindow(String title, InvasionTracker invasionTracker) {
4344
} catch (Exception ex) {
4445
ex.printStackTrace();
4546
}
47+
frame.setIconImage(Main.icon);
4648

4749
// GUI elements
4850
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/accounts/windows/NewAccountWindow.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.accounts.windows;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.accounts.JSONManager;
2122

2223
import javax.swing.*;
@@ -34,6 +35,7 @@ public NewAccountWindow(String title) {
3435
} catch (Exception ex) {
3536
ex.printStackTrace();
3637
}
38+
frame.setIconImage(Main.icon);
3739

3840
// GUI elements
3941
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/accounts/windows/OptionsWindow.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.accounts.windows;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.accounts.JSONManager;
2122

2223
import javax.swing.*;
@@ -34,6 +35,7 @@ public OptionsWindow(String title) {
3435
} catch (Exception ex) {
3536
ex.printStackTrace();
3637
}
38+
frame.setIconImage(Main.icon);
3739

3840
// GUI elements
3941
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/accounts/windows/SecretPrompt.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.accounts.windows;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.accounts.Account;
2122
import lol.hyper.customlauncher.accounts.JSONManager;
2223
import lol.hyper.customlauncher.login.LoginHandler;
@@ -37,6 +38,7 @@ public SecretPrompt(String title, Account account) {
3738
} catch (Exception ex) {
3839
ex.printStackTrace();
3940
}
41+
frame.setIconImage(Main.icon);
4042

4143
// GUI elements
4244
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/invasiontracker/InvasionTracker.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.invasiontracker;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.generic.ErrorWindow;
2122
import org.apache.logging.log4j.LogManager;
2223
import org.apache.logging.log4j.Logger;
@@ -66,6 +67,7 @@ public void showWindow() {
6667
} catch (Exception ex) {
6768
ex.printStackTrace();
6869
}
70+
frame.setIconImage(Main.icon);
6971

7072
// GUI elements
7173
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/login/windows/TwoFactorAuth.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.login.windows;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.login.LoginHandler;
2122
import lol.hyper.customlauncher.login.LoginRequest;
2223

@@ -37,6 +38,7 @@ public TwoFactorAuth(String title, String banner, String token) {
3738
} catch (Exception ex) {
3839
ex.printStackTrace();
3940
}
41+
frame.setIconImage(Main.icon);
4042

4143
// GUI elements
4244
JPanel panel = new JPanel();

src/main/java/lol/hyper/customlauncher/ttrupdater/TTRUpdater.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package lol.hyper.customlauncher.ttrupdater;
1919

20+
import lol.hyper.customlauncher.Main;
2021
import lol.hyper.customlauncher.accounts.JSONManager;
2122
import lol.hyper.customlauncher.generic.ErrorWindow;
2223
import lol.hyper.customlauncher.generic.InfoWindow;
@@ -29,6 +30,7 @@
2930

3031
import javax.swing.*;
3132
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
33+
import java.awt.*;
3234
import java.io.*;
3335
import java.net.URL;
3436
import java.net.URLConnection;
@@ -60,6 +62,8 @@ public TTRUpdater(String title, Path installLocation) throws IOException {
6062
logger.error(e);
6163
}
6264

65+
frame.setIconImage(Main.icon);
66+
6367
// GUI elements
6468
JPanel panel = new JPanel();
6569
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

0 commit comments

Comments
 (0)