package com.drbob42.article.splash; import com.drbob42.splash.*; import borland.jbcl.control.*; import java.beans.*; import java.awt.*; public class SplashWindow extends WindowWrapper { ImageControl imageControl1; BorderLayout borderLayout1; public SplashWindow() { try { jbInit(); /* * Load image */ imageControl1.setImageName("splash.gif"); } catch (Exception e) { e.printStackTrace(); } /* * Center splash window on screen */ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension splashWindowSize = getSize(); if (splashWindowSize.height > screenSize.height) { splashWindowSize.height = screenSize.height; } if (splashWindowSize.width > screenSize.width) { splashWindowSize.width = screenSize.width; } setLocation((screenSize.width - splashWindowSize.width) / 2, (screenSize.height - splashWindowSize.height) / 2); } private void jbInit() throws Exception { imageControl1 = (ImageControl) Beans.instantiate(getClass().getClassLoader(), ImageControl.class.getName()); borderLayout1 = (BorderLayout) Beans.instantiate(getClass().getClassLoader(), BorderLayout.class.getName()); this.setSize(new Dimension(300, 170)); this.setLayout(borderLayout1); this.add(imageControl1, BorderLayout.CENTER); } }