diff --git a/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterPane.java b/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterPane.java index 0c549bb..389acaf 100644 --- a/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterPane.java +++ b/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterPane.java @@ -6,7 +6,7 @@ import java.awt.RenderingHints; import java.io.IOException; -import javax.swing.ImageIcon; +import javax.imageio.ImageIO; import javax.swing.JPanel; import javax.swing.SpringLayout; @@ -22,25 +22,31 @@ public class UpdaterPane extends JPanel { private static final long serialVersionUID = -4429924866600191261L; private static final String[] STREAMERS = { - "template" // TODO Find new streamers + "stallion", + "flankthomas", + "jcodude", + "himichannel", + "statice06", }; - private @Setter @NonNull DialogAnimation currentAnimation = new BlankAnimation(); - - private String chosenStreamer = STREAMERS[0]; // Default is required for WindowBuilder. - private Image chosenStreamerImage; - - private @Getter UpdaterUI ui; + public static String chosenStreamer = STREAMERS[0]; // Default is required for WindowBuilder. + private static Image chosenStreamerImage; - public UpdaterPane(UpdaterDialog dialog, DialogAnimation animation) throws IOException { + static { try { - this.chosenStreamer = STREAMERS[(int) Math.floor(Math.random() * STREAMERS.length)]; - this.chosenStreamerImage = new ImageIcon(FileUtil.loadResourceAsUrl(String.format("assets/streamers/%s.png", this.chosenStreamer))).getImage(); - FastLogger.logStatic("Chosen Streamer: %s", this.chosenStreamer); + chosenStreamer = STREAMERS[(int) Math.floor(Math.random() * STREAMERS.length)]; + chosenStreamerImage = ImageIO.read(FileUtil.loadResourceAsUrl(String.format("assets/streamers/%s.png", chosenStreamer))); + FastLogger.logStatic("Chosen Streamer: %s", chosenStreamer); } catch (Exception e) { FastLogger.logException(e); } + } + private @Setter @NonNull DialogAnimation currentAnimation = new BlankAnimation(); + + private @Getter UpdaterUI ui; + + public UpdaterPane(UpdaterDialog dialog, DialogAnimation animation) throws IOException { this.currentAnimation = animation; SpringLayout layout = new SpringLayout(); @@ -77,9 +83,9 @@ public void paint(Graphics g) { this.currentAnimation.paintOnBackground(g2d); // Paint the background image if set - if (this.chosenStreamerImage != null) { + if (chosenStreamerImage != null) { // The image is same size as the window. - g2d.drawImage(this.chosenStreamerImage, 0, 0, null); + g2d.drawImage(chosenStreamerImage, 0, 0, null); } // Paint the animation (over background) diff --git a/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterUI.java b/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterUI.java index 033a67d..d857560 100644 --- a/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterUI.java +++ b/src/main/java/co/casterlabs/caffeinated/updater/window/UpdaterUI.java @@ -14,6 +14,8 @@ public class UpdaterUI extends JPanel { private static final long serialVersionUID = -6590073036152631171L; + public static final Font FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14); + private JLabel statusText; private LoadingSpinner loadingSpinner; @@ -35,12 +37,22 @@ public UpdaterUI(UpdaterDialog dialog, DialogAnimation animation) throws IOExcep statusText = new JLabel(); layout.putConstraint(SpringLayout.SOUTH, statusText, -32, SpringLayout.SOUTH, this); layout.putConstraint(SpringLayout.EAST, statusText, -10, SpringLayout.EAST, this); - statusText.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14)); + statusText.setFont(FONT); statusText.setForeground(UpdaterDialog.TEXT_COLOR); statusText.setOpaque(false); statusText.setText("Checking for updates..."); this.add(statusText); + JLabel streamerText = new JLabel(); + layout.putConstraint(SpringLayout.SOUTH, streamerText, -9, SpringLayout.SOUTH, this); + layout.putConstraint(SpringLayout.EAST, streamerText, -10, SpringLayout.EAST, this); + streamerText.setFont(FONT); + streamerText.setHorizontalAlignment(JLabel.RIGHT); + streamerText.setForeground(UpdaterDialog.TEXT_COLOR); + streamerText.setOpaque(false); + streamerText.setText("@" + UpdaterPane.chosenStreamer); + this.add(streamerText); + loadingSpinner = new LoadingSpinner(); layout.putConstraint(SpringLayout.NORTH, statusText, 13, SpringLayout.NORTH, loadingSpinner); layout.putConstraint(SpringLayout.WEST, statusText, 6, SpringLayout.EAST, loadingSpinner); diff --git a/src/main/resources/assets/streamers/flankthomas.png b/src/main/resources/assets/streamers/flankthomas.png new file mode 100644 index 0000000..21124cb Binary files /dev/null and b/src/main/resources/assets/streamers/flankthomas.png differ diff --git a/src/main/resources/assets/streamers/himichannel.png b/src/main/resources/assets/streamers/himichannel.png new file mode 100644 index 0000000..0ad8333 Binary files /dev/null and b/src/main/resources/assets/streamers/himichannel.png differ diff --git a/src/main/resources/assets/streamers/jcodude.png b/src/main/resources/assets/streamers/jcodude.png new file mode 100644 index 0000000..42b174c Binary files /dev/null and b/src/main/resources/assets/streamers/jcodude.png differ diff --git a/src/main/resources/assets/streamers/stallion.png b/src/main/resources/assets/streamers/stallion.png new file mode 100644 index 0000000..3d44bc2 Binary files /dev/null and b/src/main/resources/assets/streamers/stallion.png differ diff --git a/src/main/resources/assets/streamers/statice06.png b/src/main/resources/assets/streamers/statice06.png new file mode 100644 index 0000000..f863276 Binary files /dev/null and b/src/main/resources/assets/streamers/statice06.png differ