create ost gen class, change center of windows

This commit is contained in:
Downforce Agent 2024-07-12 22:40:25 -05:00
parent 5e8227dfaa
commit 3cc78caf62
9 changed files with 95 additions and 9 deletions

View File

@ -53,7 +53,7 @@ public class Bert implements ActionListener {
frame.setResizable(false); frame.setResizable(false);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(parent);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
radios.add(baseRad); radios.add(baseRad);

View File

@ -71,7 +71,7 @@ public class Clifford implements ActionListener {
frame.setResizable(false); frame.setResizable(false);
frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(inv.frame);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
fName.setText(mod.friendlyName); fName.setText(mod.friendlyName);

View File

@ -92,7 +92,7 @@ public class Ernie implements ActionListener {
frame.setTitle("An update is available!"); frame.setTitle("An update is available!");
frame.setSize(450, 400); frame.setSize(450, 400);
frame.setResizable(false); frame.setResizable(false);
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(parent);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
parent.setEnabled(false); parent.setEnabled(false);

View File

@ -67,7 +67,7 @@ public class Gonzo {
frame.setResizable(false); frame.setResizable(false);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(inv.frame);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
frame.setVisible(true); frame.setVisible(true);

View File

@ -343,7 +343,7 @@ public class MissPiggy implements ActionListener {
if (actionEvent.getSource() == toolsMenu.getItem(0)) {metaEditorGUI(modList.getSelectedIndex());} else if (actionEvent.getSource() == toolsMenu.getItem(0)) {metaEditorGUI(modList.getSelectedIndex());} else
if (actionEvent.getSource() == toolsMenu.getItem(1)) {generatorGUI();} 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)) { if (actionEvent.getSource() == helpMenu.getItem(0)) {
try { try {
@ -370,7 +370,7 @@ public class MissPiggy implements ActionListener {
} }
} else } else
if (actionEvent.getSource() == helpMenu.getItem(5)) {StartErnie();} 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. // Will likely split the below functions into separate classes to work with intellij GUI designer.

View File

@ -35,7 +35,7 @@ public class Rowlf {
private JLabel versionLabel; private JLabel versionLabel;
private JLabel environmentLabel; private JLabel environmentLabel;
public Rowlf() { public Rowlf(JFrame parent) {
try { try {
logo = ImageIO.read(Main.class.getResourceAsStream("/logo.png")).getScaledInstance(333, 100, Image.SCALE_SMOOTH); logo = ImageIO.read(Main.class.getResourceAsStream("/logo.png")).getScaledInstance(333, 100, Image.SCALE_SMOOTH);
} catch (IOException e) { } catch (IOException e) {
@ -76,7 +76,7 @@ public class Rowlf {
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(parent);
frame.setVisible(true); frame.setVisible(true);
} }
} }

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="Suggs">
<grid id="27dc6" binding="frameContainer" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties>
<background color="-15128227"/>
<font name="Exo 2"/>
<foreground color="-1"/>
</properties>
<border type="none"/>
<children/>
</grid>
</form>

View File

@ -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
}
}

View File

@ -61,7 +61,7 @@ public class Waldorf implements ActionListener {
frame.setResizable(false); frame.setResizable(false);
frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(inv.frame);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
cancelbtn.addActionListener(this); cancelbtn.addActionListener(this);