com.isti.util.gui
Class SplashWindow

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjavax.swing.JWindow
                  extended bycom.isti.util.gui.SplashWindow
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable

public class SplashWindow
extends javax.swing.JWindow

Class SplashWindow defines a splash window to be shown while a program is constructing and loading its GUI. The size of the display screen may also be queried via the static 'getDisplayScreenSize()' method. A simple "Program loading..." splash window may be displayed by using the no-parameter constructor and then calling 'show()' in the 'main()' method of the program. The 'close()' method should be called just before the program GUI is made visible. See the various constructors for other possible variations on the window's contents and position.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JWindow
javax.swing.JWindow.AccessibleJWindow
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int DEF_INC_HEIGHT
          Default height increase for splash screen window (25).
static int DEF_INC_WIDTH
          Default width increase for splash screen window (100).
static java.lang.String DEF_TEXT_STR
          Default text string for splash screen window ("Program loading...").
protected static java.awt.Dimension screenSizeDimObj
           
 
Fields inherited from class javax.swing.JWindow
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SplashWindow()
          Creates a splash window object using the default text string (see 'DEF_TEXT_STR').
SplashWindow(java.awt.Component compObj)
          Creates a splash window object.
SplashWindow(java.awt.Component compObj, int incWidth, int incHeight)
          Creates a splash window object.
SplashWindow(java.lang.String textStr)
          Creates a splash window object using the given text string.
SplashWindow(java.lang.String textStr, javax.swing.Icon iconObj)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, javax.swing.Icon iconObj, int horizontalAlignment)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, javax.swing.Icon iconObj, int horizontalAlignment, int incWidth, int incHeight)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, int horizontalAlignment)
          Creates a splash window object using the given text string.
SplashWindow(java.lang.String textStr, int horizontalAlignment, int incWidth, int incHeight)
          Creates a splash window object using the given text string.
SplashWindow(java.lang.String textStr, java.lang.String iconURLStr)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, java.lang.String iconURLStr, boolean textBackupFlag)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, java.lang.String iconURLStr, int horizontalAlignment)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, java.lang.String iconURLStr, int horizontalAlignment, boolean textBackupFlag)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, java.lang.String iconURLStr, int horizontalAlignment, int incWidth, int incHeight)
          Creates a splash window object using the given text string and/or icon object.
SplashWindow(java.lang.String textStr, java.lang.String iconURLStr, int horizontalAlignment, int incWidth, int incHeight, boolean textBackupFlag)
          Creates a splash window object using the given text string and/or icon object.
 
Method Summary
 void close()
          Hides and disposes the splash screen window.
protected  void createComponentWindow(java.awt.Component compObj, int incWidth, int incHeight)
          Creates the splash window object.
protected  void createLabelWindow(java.lang.String textStr, javax.swing.Icon iconObj, int horizontalAlignment, int incWidth, int incHeight)
          Creates the splash window object using the given text string and/or icon object.
protected  void createLabelWindow(java.lang.String textStr, java.lang.String iconURLStr, int horizontalAlignment, int incWidth, int incHeight, boolean textBackupFlag)
          Creates the splash window object using the given text string and/or icon object.
static java.awt.Dimension getDisplayScreenSize()
          Returns a 'Dimension' object containing the size of the display screen.
 void pack(boolean centerFlag)
          Sizes the splash screen window to the size of its contents.
 void pack(int incWidth, int incHeight, boolean centerFlag)
          Sizes the splash screen window to the size of its contents and then increases its size by the given values.
 void showWindow()
          Displays the splash screen window.
 
Methods inherited from class javax.swing.JWindow
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update, windowInit
 
Methods inherited from class java.awt.Window
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEF_INC_WIDTH

public static final int DEF_INC_WIDTH
Default width increase for splash screen window (100).

See Also:
Constant Field Values

DEF_INC_HEIGHT

public static final int DEF_INC_HEIGHT
Default height increase for splash screen window (25).

See Also:
Constant Field Values

DEF_TEXT_STR

public static final java.lang.String DEF_TEXT_STR
Default text string for splash screen window ("Program loading...").

See Also:
Constant Field Values

screenSizeDimObj

protected static java.awt.Dimension screenSizeDimObj
Constructor Detail

SplashWindow

public SplashWindow(java.awt.Component compObj,
                    int incWidth,
                    int incHeight)
Creates a splash window object. The window is sized to fit its contents, and then its size is increased by the given values.

Parameters:
compObj - the component to be displayed in the window.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.

SplashWindow

public SplashWindow(java.awt.Component compObj)
Creates a splash window object. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'.

Parameters:
compObj - the component to be displayed in the window.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    javax.swing.Icon iconObj,
                    int horizontalAlignment,
                    int incWidth,
                    int incHeight)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the given values.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconObj - the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    javax.swing.Icon iconObj,
                    int horizontalAlignment)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconObj - the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    javax.swing.Icon iconObj)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'. The text alignment in the window will be 'CENTER'.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconObj - the icon to be displayed in the window, or null or none.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    java.lang.String iconURLStr,
                    int horizontalAlignment,
                    int incWidth,
                    int incHeight,
                    boolean textBackupFlag)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the given values.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconURLStr - URL or filename for the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.
textBackupFlag - if true then only show the text string if the icon URL could not be loaded; if false then always show the text string.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    java.lang.String iconURLStr,
                    int horizontalAlignment,
                    boolean textBackupFlag)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconURLStr - URL or filename for the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
textBackupFlag - if true then only show the text string if the icon URL could not be loaded; if false then always show the text string.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    java.lang.String iconURLStr,
                    boolean textBackupFlag)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'. The text alignment in the window will be 'CENTER'.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconURLStr - URL or filename for the icon to be displayed in the window, or null or none.
textBackupFlag - if true then only show the text string if the icon URL could not be loaded; if false then always show the text string.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    java.lang.String iconURLStr,
                    int horizontalAlignment,
                    int incWidth,
                    int incHeight)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the given values.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconURLStr - URL or filename for the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    java.lang.String iconURLStr,
                    int horizontalAlignment)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconURLStr - URL or filename for the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    java.lang.String iconURLStr)
Creates a splash window object using the given text string and/or icon object. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'. The text alignment in the window will be 'CENTER'.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconURLStr - URL or filename for the icon to be displayed in the window, or null or none.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    int horizontalAlignment,
                    int incWidth,
                    int incHeight)
Creates a splash window object using the given text string. The window is sized to fit its contents, and then its size is increased by the given values.

Parameters:
textStr - the text to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.

SplashWindow

public SplashWindow(java.lang.String textStr,
                    int horizontalAlignment)
Creates a splash window object using the given text string. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'.

Parameters:
textStr - the text to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.

SplashWindow

public SplashWindow(java.lang.String textStr)
Creates a splash window object using the given text string. The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'. The text alignment in the window will be 'CENTER'.

Parameters:
textStr - the text to be displayed in the window, or null or none.

SplashWindow

public SplashWindow()
Creates a splash window object using the default text string (see 'DEF_TEXT_STR'). The window is sized to fit its contents, and then its size is increased by the default values 'DEF_INC_WIDTH' and 'DEF_INC_HEIGHT'. The text alignment in the window will be 'CENTER'.

Method Detail

createComponentWindow

protected void createComponentWindow(java.awt.Component compObj,
                                     int incWidth,
                                     int incHeight)
Creates the splash window object. The window is sized to fit it contents, and then its size is increased by the given values.

Parameters:
compObj - the component to be displayed in the window.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.

createLabelWindow

protected void createLabelWindow(java.lang.String textStr,
                                 javax.swing.Icon iconObj,
                                 int horizontalAlignment,
                                 int incWidth,
                                 int incHeight)
Creates the splash window object using the given text string and/or icon object. The window is sized to fit it contents, and then its size is increased by the given values.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconObj - the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.

createLabelWindow

protected void createLabelWindow(java.lang.String textStr,
                                 java.lang.String iconURLStr,
                                 int horizontalAlignment,
                                 int incWidth,
                                 int incHeight,
                                 boolean textBackupFlag)
Creates the splash window object using the given text string and/or icon object. The window is sized to fit it contents, and then its size is increased by the given values.

Parameters:
textStr - the text to be displayed in the window, or null or none.
iconURLStr - URL or filename for the icon to be displayed in the window, or null or none.
horizontalAlignment - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.
textBackupFlag - if true then only show the text string if the icon URL could not be loaded; if false then always show the text string.

pack

public void pack(int incWidth,
                 int incHeight,
                 boolean centerFlag)
Sizes the splash screen window to the size of its contents and then increases its size by the given values.

Parameters:
incWidth - the amount to increase the width, in pixels.
incHeight - the amount to increase the height, in pixels.
centerFlag - true to center the window on the display screen after it is resized.

pack

public void pack(boolean centerFlag)
Sizes the splash screen window to the size of its contents.

Parameters:
centerFlag - true to center the window on the display screen after it is resized.

showWindow

public void showWindow()
Displays the splash screen window.


close

public void close()
Hides and disposes the splash screen window.


getDisplayScreenSize

public static java.awt.Dimension getDisplayScreenSize()
Returns a 'Dimension' object containing the size of the display screen. If an error occurs then a message is sent to 'stderr' and a size of 800x600 is returned.

Returns:
A 'Dimension' object containing the display screen size.