Add window icon to new dialogs

This commit is contained in:
Downforce Agent 2024-07-03 15:35:56 -05:00
parent c00983843a
commit 541e579401
2 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import org.json.JSONObject;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
@ -28,7 +29,9 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
@ -56,6 +59,12 @@ public class Clifford implements ActionListener {
creating = false;
frame.add(frameContainer);
try {
BufferedImage windowIcon = ImageIO.read(new File(System.getProperty("user.dir") + "/resources/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
frame.setSize(600, 300); // 1280 800
frame.setMinimumSize(new Dimension(200,100));
frame.setTitle("Options");

View File

@ -18,12 +18,14 @@
import org.json.JSONObject;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@ -43,6 +45,12 @@ public class Waldorf implements ActionListener {
invoker = inv;
frame.add(frameContainer);
try {
BufferedImage windowIcon = ImageIO.read(new File(System.getProperty("user.dir") + "/resources/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
frame.setSize(600, 200); // 1280 800
frame.setMinimumSize(new Dimension(200,100));
frame.setTitle("Options");