summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/SplashScreen.java
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/hjp5/examples/SplashScreen.java
downloadStudium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz
Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/SplashScreen.java')
-rw-r--r--Master/Reference Architectures and Patterns/hjp5/examples/SplashScreen.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/SplashScreen.java b/Master/Reference Architectures and Patterns/hjp5/examples/SplashScreen.java
new file mode 100644
index 0000000..29f3cd4
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/hjp5/examples/SplashScreen.java
@@ -0,0 +1,50 @@
+/* SplashScreen.java */
+
+import javax.swing.*;
+import javax.swing.border.*;
+import java.awt.*;
+import java.awt.event.*;
+
+public class SplashScreen
+extends JWindow
+{
+ public SplashScreen(String image, String text)
+ {
+ JPanel contentPane = new JPanel();
+ contentPane.setLayout(new BorderLayout());
+ Border bd1 = BorderFactory.createBevelBorder(
+ BevelBorder.RAISED
+ );
+ Border bd2 = BorderFactory.createEtchedBorder();
+ Border bd3 = BorderFactory.createCompoundBorder(bd1, bd2);
+ ((JPanel)contentPane).setBorder(bd3);
+ ImageIcon icon = new ImageIcon(image);
+ contentPane.add(new JLabel(" ", JLabel.CENTER), BorderLayout.NORTH);
+ contentPane.add(new JLabel(icon, JLabel.CENTER), BorderLayout.CENTER);
+ contentPane.add(new JLabel(text, JLabel.CENTER), BorderLayout.SOUTH);
+ setContentPane(contentPane);
+ }
+
+ public void showFor(int millis)
+ {
+ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
+ setLocation(dim.width / 3, dim.height / 3);
+ setSize(dim.width / 3, dim.height / 3);
+ setVisible(true);
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ }
+ setVisible(false);
+ }
+
+ public static void main(String[] args)
+ {
+ SplashScreen intro = new SplashScreen(
+ "mine.gif",
+ "(C) Copyright 2000, J. Krüger, All Rights Reserved"
+ );
+ intro.showFor(3000);
+ System.exit(0);
+ }
+} \ No newline at end of file