From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- NET/worlds/console/SplashScreen.java | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 NET/worlds/console/SplashScreen.java (limited to 'NET/worlds/console/SplashScreen.java') 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!"); + } + } +} -- cgit v1.2.3