From 3cc78caf62c120d72e9543e8a21c80eb31d53ba5 Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Fri, 12 Jul 2024 22:40:25 -0500 Subject: [PATCH] create ost gen class, change center of windows --- firestar/src/main/java/Bert.java | 2 +- firestar/src/main/java/Clifford.java | 2 +- firestar/src/main/java/Ernie.java | 2 +- firestar/src/main/java/Gonzo.java | 2 +- firestar/src/main/java/MissPiggy.java | 4 +- firestar/src/main/java/Rowlf.java | 4 +- firestar/src/main/java/Suggs.form | 16 ++++++ firestar/src/main/java/Suggs.java | 70 +++++++++++++++++++++++++++ firestar/src/main/java/Waldorf.java | 2 +- 9 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 firestar/src/main/java/Suggs.form create mode 100644 firestar/src/main/java/Suggs.java diff --git a/firestar/src/main/java/Bert.java b/firestar/src/main/java/Bert.java index eb2b36c..6ccc765 100644 --- a/firestar/src/main/java/Bert.java +++ b/firestar/src/main/java/Bert.java @@ -53,7 +53,7 @@ public class Bert implements ActionListener { frame.setResizable(false); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.setLayout(new GridLayout()); - frame.setLocationRelativeTo(null); + frame.setLocationRelativeTo(parent); frame.setAlwaysOnTop(true); radios.add(baseRad); diff --git a/firestar/src/main/java/Clifford.java b/firestar/src/main/java/Clifford.java index 7a230cb..94b78fc 100644 --- a/firestar/src/main/java/Clifford.java +++ b/firestar/src/main/java/Clifford.java @@ -71,7 +71,7 @@ public class Clifford implements ActionListener { frame.setResizable(false); frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); frame.setLayout(new GridLayout()); - frame.setLocationRelativeTo(null); + frame.setLocationRelativeTo(inv.frame); frame.setAlwaysOnTop(true); fName.setText(mod.friendlyName); diff --git a/firestar/src/main/java/Ernie.java b/firestar/src/main/java/Ernie.java index 9e69e51..bfd83bb 100644 --- a/firestar/src/main/java/Ernie.java +++ b/firestar/src/main/java/Ernie.java @@ -92,7 +92,7 @@ public class Ernie implements ActionListener { frame.setTitle("An update is available!"); frame.setSize(450, 400); frame.setResizable(false); - frame.setLocationRelativeTo(null); + frame.setLocationRelativeTo(parent); frame.setAlwaysOnTop(true); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); parent.setEnabled(false); diff --git a/firestar/src/main/java/Gonzo.java b/firestar/src/main/java/Gonzo.java index cc447bf..d2bf659 100644 --- a/firestar/src/main/java/Gonzo.java +++ b/firestar/src/main/java/Gonzo.java @@ -67,7 +67,7 @@ public class Gonzo { frame.setResizable(false); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.setLayout(new GridLayout()); - frame.setLocationRelativeTo(null); + frame.setLocationRelativeTo(inv.frame); frame.setAlwaysOnTop(true); frame.setVisible(true); diff --git a/firestar/src/main/java/MissPiggy.java b/firestar/src/main/java/MissPiggy.java index 5712655..332bbc3 100644 --- a/firestar/src/main/java/MissPiggy.java +++ b/firestar/src/main/java/MissPiggy.java @@ -343,7 +343,7 @@ public class MissPiggy implements ActionListener { if (actionEvent.getSource() == toolsMenu.getItem(0)) {metaEditorGUI(modList.getSelectedIndex());} else if (actionEvent.getSource() == toolsMenu.getItem(1)) {generatorGUI();} else - if (actionEvent.getSource() == toolsMenu.getItem(2)) {throwUnimplemented();} else + if (actionEvent.getSource() == toolsMenu.getItem(2)) {new Suggs(frame);} else if (actionEvent.getSource() == helpMenu.getItem(0)) { try { @@ -370,7 +370,7 @@ public class MissPiggy implements ActionListener { } } else if (actionEvent.getSource() == helpMenu.getItem(5)) {StartErnie();} else - if (actionEvent.getSource() == helpMenu.getItem(6)) {new Rowlf();} + if (actionEvent.getSource() == helpMenu.getItem(6)) {new Rowlf(frame);} } // Will likely split the below functions into separate classes to work with intellij GUI designer. diff --git a/firestar/src/main/java/Rowlf.java b/firestar/src/main/java/Rowlf.java index 81394d1..eef0ee5 100644 --- a/firestar/src/main/java/Rowlf.java +++ b/firestar/src/main/java/Rowlf.java @@ -35,7 +35,7 @@ public class Rowlf { private JLabel versionLabel; private JLabel environmentLabel; - public Rowlf() { + public Rowlf(JFrame parent) { try { logo = ImageIO.read(Main.class.getResourceAsStream("/logo.png")).getScaledInstance(333, 100, Image.SCALE_SMOOTH); } catch (IOException e) { @@ -76,7 +76,7 @@ public class Rowlf { frame.setAlwaysOnTop(true); frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); frame.setLayout(new GridLayout()); - frame.setLocationRelativeTo(null); + frame.setLocationRelativeTo(parent); frame.setVisible(true); } } diff --git a/firestar/src/main/java/Suggs.form b/firestar/src/main/java/Suggs.form new file mode 100644 index 0000000..cea180c --- /dev/null +++ b/firestar/src/main/java/Suggs.form @@ -0,0 +1,16 @@ + +
+ + + + + + + + + + + + + + diff --git a/firestar/src/main/java/Suggs.java b/firestar/src/main/java/Suggs.java new file mode 100644 index 0000000..08c6661 --- /dev/null +++ b/firestar/src/main/java/Suggs.java @@ -0,0 +1,70 @@ +/* + * Firestar Mod Manager + * Copyright (C) 2024 bonkmaykr + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; +import java.io.IOException; + +import static javax.swing.WindowConstants.EXIT_ON_CLOSE; + +public class Suggs { + private BufferedImage windowIcon; + public JFrame frame = new JFrame(); + private JPanel frameContainer; + + public Suggs(JFrame parent) { + parent.setEnabled(false); + + try { + windowIcon = ImageIO.read(Main.class.getResourceAsStream("/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.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA + + frame.setSize(600, 600); + frame.setMinimumSize(new Dimension(600,600)); + frame.setTitle("Soundtrack Mod Generator"); + frame.setResizable(true); + frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + frame.setLayout(new GridLayout()); + frame.setLocationRelativeTo(parent); + frame.setAlwaysOnTop(true); + + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) + { + parent.setEnabled(true); + e.getWindow().dispose(); + } + }); + + frame.setVisible(true); + } + + private void haveSeggs() { // kill yourself + + } +} diff --git a/firestar/src/main/java/Waldorf.java b/firestar/src/main/java/Waldorf.java index f9c525c..81ab593 100644 --- a/firestar/src/main/java/Waldorf.java +++ b/firestar/src/main/java/Waldorf.java @@ -61,7 +61,7 @@ public class Waldorf implements ActionListener { frame.setResizable(false); frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); frame.setLayout(new GridLayout()); - frame.setLocationRelativeTo(null); + frame.setLocationRelativeTo(inv.frame); frame.setAlwaysOnTop(true); cancelbtn.addActionListener(this);