Remembers if maximized or not
This commit is contained in:
parent
c67f3c2221
commit
d130744b32
@ -30,6 +30,7 @@ package net.apocalypselabs.symat;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.FontFormatException;
|
import java.awt.FontFormatException;
|
||||||
|
import static java.awt.Frame.MAXIMIZED_BOTH;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
@ -80,8 +81,8 @@ public class MainGUI extends javax.swing.JFrame {
|
|||||||
getClass().getResource("icon.png"))).getImage());
|
getClass().getResource("icon.png"))).getImage());
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
// Run things when closed
|
||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent we) {
|
public void windowClosing(WindowEvent we) {
|
||||||
int p = JOptionPane.showConfirmDialog(MainGUI.mainPane,
|
int p = JOptionPane.showConfirmDialog(MainGUI.mainPane,
|
||||||
@ -90,6 +91,11 @@ public class MainGUI extends javax.swing.JFrame {
|
|||||||
JOptionPane.YES_NO_OPTION,
|
JOptionPane.YES_NO_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE);
|
JOptionPane.QUESTION_MESSAGE);
|
||||||
if (p == JOptionPane.YES_OPTION) {
|
if (p == JOptionPane.YES_OPTION) {
|
||||||
|
if (getExtendedState() == MAXIMIZED_BOTH) {
|
||||||
|
PrefStorage.saveSetting("framemaxed", "yes");
|
||||||
|
} else {
|
||||||
|
PrefStorage.saveSetting("framemaxed", "no");
|
||||||
|
}
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,6 +142,20 @@ public class MainGUI extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
loadRecentFiles();
|
loadRecentFiles();
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
setVisible(true);
|
||||||
|
if (PrefStorage.getSetting("framemaxed", "no").equals("yes")) {
|
||||||
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(500);
|
||||||
|
// } catch (InterruptedException ex) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
setExtendedState(MAXIMIZED_BOTH);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void licenseRestrict(boolean restricted) {
|
public static void licenseRestrict(boolean restricted) {
|
||||||
|
@ -126,7 +126,7 @@ public class SplashScreen extends javax.swing.JFrame {
|
|||||||
checkUpdates();
|
checkUpdates();
|
||||||
|
|
||||||
setProgress("Loading main interface...");
|
setProgress("Loading main interface...");
|
||||||
new MainGUI().setVisible(true);
|
MainGUI main = new MainGUI();
|
||||||
setProgress("Done!");
|
setProgress("Done!");
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user