From a568f3f5923e0af77c89e2c8e2bf6b808f29d069 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 15 Jun 2025 23:30:56 +0300 Subject: Add splash screen functionality and update build documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add VSSplashScreen component using Java Swing framework - Display splash.png image for 3 seconds on application startup - Scale splash screen to 40% of original size (60% reduction) - Update CLAUDE.md with JAVA_HOME setup instructions for all platforms - Integrate splash screen into VSMain startup sequence 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/main/java/simulator/VSSplashScreen.java | 89 +++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/main/java/simulator/VSSplashScreen.java (limited to 'src/main/java/simulator/VSSplashScreen.java') diff --git a/src/main/java/simulator/VSSplashScreen.java b/src/main/java/simulator/VSSplashScreen.java new file mode 100644 index 0000000..d8e97d6 --- /dev/null +++ b/src/main/java/simulator/VSSplashScreen.java @@ -0,0 +1,89 @@ +package simulator; + +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import javax.imageio.ImageIO; +import java.io.IOException; +import java.io.InputStream; + +/** + * Splash screen for the DS-Sim application + * + * @author Paul C. Buetow + */ +public class VSSplashScreen extends JWindow { + private static final int DISPLAY_TIME = 3000; // 3 seconds + + /** + * Creates and shows the splash screen + */ + public VSSplashScreen() { + initSplashScreen(); + } + + /** + * Initialize the splash screen components + */ + private void initSplashScreen() { + try { + // Load the splash image from resources + InputStream imageStream = getClass().getResourceAsStream("/splash.png"); + if (imageStream == null) { + // Fallback if image not found + showTextSplash(); + return; + } + + BufferedImage splashImage = ImageIO.read(imageStream); + + // Reduce size by 60% (scale to 40% of original) + int scaledWidth = (int)(splashImage.getWidth() * 0.4); + int scaledHeight = (int)(splashImage.getHeight() * 0.4); + + Image scaledImage = splashImage.getScaledInstance(scaledWidth, scaledHeight, Image.SCALE_SMOOTH); + ImageIcon splashIcon = new ImageIcon(scaledImage); + + JLabel splashLabel = new JLabel(splashIcon); + splashLabel.setHorizontalAlignment(JLabel.CENTER); + + getContentPane().add(splashLabel, BorderLayout.CENTER); + + // Set window properties + setSize(scaledWidth, scaledHeight); + setLocationRelativeTo(null); // Center on screen + + } catch (IOException e) { + // Fallback to text splash if image loading fails + showTextSplash(); + } + } + + /** + * Fallback text-based splash screen + */ + private void showTextSplash() { + JLabel textLabel = new JLabel("DS-Sim", JLabel.CENTER); + textLabel.setFont(new Font("Arial", Font.BOLD, 24)); + textLabel.setPreferredSize(new Dimension(300, 100)); + + getContentPane().add(textLabel, BorderLayout.CENTER); + setSize(300, 100); + setLocationRelativeTo(null); + } + + /** + * Shows the splash screen for the specified duration + */ + public void showSplash() { + setVisible(true); + + // Use a timer to hide the splash screen after the specified time + Timer timer = new Timer(DISPLAY_TIME, e -> { + setVisible(false); + dispose(); + }); + timer.setRepeats(false); + timer.start(); + } +} \ No newline at end of file -- cgit v1.2.3