summaryrefslogtreecommitdiff
path: root/NET/worlds/console/SplashScreen.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/SplashScreen.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/console/SplashScreen.java')
-rw-r--r--NET/worlds/console/SplashScreen.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/NET/worlds/console/SplashScreen.java b/NET/worlds/console/SplashScreen.java
new file mode 100644
index 0000000..4ebf637
--- /dev/null
+++ b/NET/worlds/console/SplashScreen.java
@@ -0,0 +1,53 @@
+package NET.worlds.console;
+
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Toolkit;
+
+public class SplashScreen extends java.awt.Window {
+ private static final long serialVersionUID = 4848128412139723543L;
+ private SplashCanvas sc = null;
+
+ public SplashScreen(String appname, String imagename) {
+ super(new Frame(appname));
+ this.sc = new SplashCanvas(imagename);
+ this.add(this.sc);
+ this.pack();
+ this.center();
+ }
+
+ public void setImageName(String imagename) {
+ this.sc.setImage(imagename);
+ this.pack();
+ this.center();
+ this.sc.repaint();
+ }
+
+ public void addOverlay(String name, int x, int y) {
+ this.sc.addOverlay(name, x, y);
+ this.center();
+ }
+
+ public void removeOverlay(String name, int x, int y) {
+ this.sc.removeOverlay(name, x, y);
+ }
+
+ public void center() {
+ Dimension dim = this.getSize();
+ Dimension scrdim = Toolkit.getDefaultToolkit().getScreenSize();
+ int x = scrdim.width >= dim.width ? (scrdim.width - dim.width) / 2 : 0;
+ int y = scrdim.height >= dim.height ? (scrdim.height - dim.height) / 2 : 0;
+ this.setLocation(x, y);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+
+ try {
+ this.sc.flush();
+ } catch (NullPointerException var2) {
+ System.out.println("Flushing went bad!");
+ }
+ }
+}