Class JSplashScreen

  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by javax.swing.JWindow
                  extended by paxoftwer.forms.JSplashScreen
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer,, java.lang.Runnable, javax.accessibility.Accessible, javax.swing.RootPaneContainer

public class JSplashScreen
extends javax.swing.JWindow
implements java.lang.Runnable

This class shows a picture file from class path as splash screen on the screen center. You pass the constructor the relative file path and a millisecond time value which determines the minimum of time, the splash screen will be alive. If loading of all resources are done earlier, the splash screen remains for the rest of passed time anyway. Otherwise, the screen remains until all resources have been initialized. If they are completely initialized, don't forget to call killSplashScreen(), otherwise the splash screen will never disappear.

See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Component
Field Summary
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
JSplashScreen(long remainAtLeast, javax.swing.ImageIcon pic)
          Creates a new instance of the splash screen and shows it.
JSplashScreen(long remainAtLeast, javax.swing.ImageIcon pic, java.awt.Component progressComp)
          Creates a new instance of the splash screen and shows it.
Method Summary
 java.awt.Component getProgressComponent()
          You can specify a visual component which has to show some initialization progresses by passing it to the constructor.
 void killSplashScreen()
          Stops and disposes this splash screen.
static void main(java.lang.String[] args)
          This is only a test main method.
 void run()
Methods inherited from class javax.swing.JWindow
getAccessibleContext, getContentPane, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, remove, repaint, setContentPane, setGlassPane, setLayeredPane, setLayout, setTransferHandler, update
Methods inherited from class java.awt.Window
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public JSplashScreen(long remainAtLeast,
                     javax.swing.ImageIcon pic)
Creates a new instance of the splash screen and shows it.

remainAtLeast - Time value in milliseconds how long at least the splash screen must be shown until it will be destroyed.
pic - The picture object to be shown.


public JSplashScreen(long remainAtLeast,
                     javax.swing.ImageIcon pic,
                     java.awt.Component progressComp)
Creates a new instance of the splash screen and shows it.

remainAtLeast - Time value in milliseconds how long at least the splash screen must be shown until it will be destroyed.
pic - The picture object to be shown.
progressComp - Visual component which displays a initialization progress.
Method Detail


public void run()
Specified by:
run in interface java.lang.Runnable


public java.awt.Component getProgressComponent()
You can specify a visual component which has to show some initialization progresses by passing it to the constructor. This method returns the set component (if exists), so you can alter its values.

The currently set component which should visualize the initialization progress or null if there wasn't set one.


public void killSplashScreen()
Stops and disposes this splash screen. Do always call this method if all computing (i.e. loading of resources) have done. Otherwise the splash screen won't disappear.


public static void main(java.lang.String[] args)
                 throws java.lang.InterruptedException
This is only a test main method.

args -