Compare commits
2 Commits
656dbd0975
...
0699bc3644
Author | SHA1 | Date | |
---|---|---|---|
0699bc3644 | |||
aa5d4bb97f |
|
@ -19,6 +19,7 @@
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -30,6 +31,7 @@ import java.net.URL;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JEditorPane;
|
import javax.swing.JEditorPane;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
@ -57,15 +59,24 @@ public class Ernie implements ActionListener, Runnable {
|
||||||
private JButton surebtn;
|
private JButton surebtn;
|
||||||
|
|
||||||
public boolean backgroundDone = false;
|
public boolean backgroundDone = false;
|
||||||
|
private BufferedImage windowIcon;
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
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.");
|
||||||
|
}
|
||||||
byte[] urlraw = new Ernie().getFile(gitapi+"/releases?draft=false&pre-release=false");
|
byte[] urlraw = new Ernie().getFile(gitapi+"/releases?draft=false&pre-release=false");
|
||||||
if (urlraw.length <= 0) {
|
if (urlraw.length <= 0) {
|
||||||
JOptionPane.showMessageDialog(frame, "Internal Error: Couldn't check for updates.", "Fatal Error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(frame, "Internal Error: Couldn't check for updates.", "Fatal Error", JOptionPane.ERROR_MESSAGE);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
JSONArray releases = new JSONArray(new String(urlraw, Charset.forName("utf-8")));
|
JSONArray releases = new JSONArray(new String(urlraw, Charset.forName("utf-8")));
|
||||||
if (releases.length() >= 1 && ((JSONObject)releases.get(0)).get("tag_name") != Main.vtag) {
|
System.out.println("Updater: latest release is " + ((JSONObject)releases.get(0)).get("tag_name"));
|
||||||
|
if (releases.length() >= 1 && !((JSONObject)releases.get(0)).get("tag_name").equals(Main.vtag)) {
|
||||||
|
System.out.println("Updater: Your version is out of date.");
|
||||||
frame.add(frameContainer);
|
frame.add(frameContainer);
|
||||||
notnowbtn.addActionListener(this);
|
notnowbtn.addActionListener(this);
|
||||||
surebtn.addActionListener(this);
|
surebtn.addActionListener(this);
|
||||||
|
@ -79,7 +90,7 @@ public class Ernie implements ActionListener, Runnable {
|
||||||
frame.setLocationRelativeTo(null);
|
frame.setLocationRelativeTo(null);
|
||||||
frame.setAlwaysOnTop(true);
|
frame.setAlwaysOnTop(true);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
} else { System.out.println("Problem??"); }
|
} else { System.out.println("Updater: No updates."); }
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(Ernie.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Ernie.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class Main {
|
||||||
// Build Information
|
// Build Information
|
||||||
public static final String vstr = "Release 1.3";
|
public static final String vstr = "Release 1.3";
|
||||||
public static final String vcode = "Tetsuo";
|
public static final String vcode = "Tetsuo";
|
||||||
public static final String vtag = "dekka-1.1"; //tetsuo-1.3
|
public static final String vtag = "tetsuo-1.3"; // set to dekka-1.1 for testing
|
||||||
public static final int vint = 1;
|
public static final int vint = 1;
|
||||||
|
|
||||||
// User Settings
|
// User Settings
|
||||||
|
|
|
@ -366,7 +366,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().displayAboutScreen();}
|
if (actionEvent.getSource() == helpMenu.getItem(6)) {new Rowlf();}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
|
|
|
@ -5,16 +5,22 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<xy x="20" y="20" width="1464" height="573"/>
|
<xy x="20" y="20" width="1464" height="573"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties>
|
||||||
|
<background color="-15128227"/>
|
||||||
|
<font name="Exo 2"/>
|
||||||
|
<foreground color="-526337"/>
|
||||||
|
</properties>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<component id="a5cc7" class="javax.swing.JLabel" binding="picLabel">
|
<component id="a5cc7" class="javax.swing.JLabel" binding="picLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||||
<maximum-size width="-1" height="100"/>
|
<maximum-size width="333" height="100"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
<font name="Exo 2"/>
|
||||||
|
<foreground color="-592129"/>
|
||||||
<text value="Aww fiddlesticks, what now?"/>
|
<text value="Aww fiddlesticks, what now?"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
@ -26,6 +32,11 @@
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
<background color="-16777216"/>
|
||||||
|
<editable value="false"/>
|
||||||
|
<focusable value="false"/>
|
||||||
|
<font name="Fusion" size="10"/>
|
||||||
|
<foreground color="-5180417"/>
|
||||||
<horizontalAlignment value="0"/>
|
<horizontalAlignment value="0"/>
|
||||||
<text value="Do you think we should appeal to the alien authorities?"/>
|
<text value="Do you think we should appeal to the alien authorities?"/>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -38,6 +49,8 @@
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
<font name="Exo 2"/>
|
||||||
|
<foreground color="-592129"/>
|
||||||
<text value="Version Unknown"/>
|
<text value="Version Unknown"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
@ -49,6 +62,8 @@
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
<font name="Exo 2"/>
|
||||||
|
<foreground color="-592129"/>
|
||||||
<text value="Platform Unknown"/>
|
<text value="Platform Unknown"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -26,21 +26,28 @@ import java.io.IOException;
|
||||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
||||||
|
|
||||||
public class Rowlf {
|
public class Rowlf {
|
||||||
|
private BufferedImage windowIcon;
|
||||||
JFrame frame = new JFrame();
|
JFrame frame = new JFrame();
|
||||||
JPanel frameContainer;
|
JPanel frameContainer;
|
||||||
BufferedImage logo;
|
Image logo;
|
||||||
JLabel picLabel;
|
JLabel picLabel;
|
||||||
private JTextField informationText;
|
private JTextField informationText;
|
||||||
private JLabel versionLabel;
|
private JLabel versionLabel;
|
||||||
private JLabel environmentLabel;
|
private JLabel environmentLabel;
|
||||||
|
|
||||||
public void displayAboutScreen() {
|
public Rowlf() {
|
||||||
try {
|
try {
|
||||||
logo = ImageIO.read(Main.class.getResourceAsStream("/logo_about.png"));
|
logo = ImageIO.read(Main.class.getResourceAsStream("/logo.png")).getScaledInstance(333, 100, Image.SCALE_SMOOTH);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("ERROR: Failed to open About screen because we couldn't find an image needed to display the page.");
|
System.out.println("ERROR: Failed to open About screen because we couldn't find an image needed to display the page.");
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
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(picLabel);
|
//frame.add(picLabel);
|
||||||
frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA
|
frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue
Block a user