com.isti.util.gui
Class SplashWindow

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

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/interfaces inherited from class javax.swing.JWindow
javax.swing.JWindow.AccessibleJWindow
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static boolean createOwnerFlag
          Create the owner flag is true to create the splash window owner, false otherwise.
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.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.
protected SplashWindow(java.awt.Frame owner)
          Creates a splash window object using the specified frame.
  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.
protected static java.awt.Frame createOwner()
          Creates the owner.
 void dispose()
          Hides and disposes the splash screen window.
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, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update, windowInit
 
Methods inherited from class java.awt.Window
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, 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, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

createOwnerFlag

public static boolean createOwnerFlag
Create the owner flag is true to create the splash window owner, false otherwise. The use of the owner allows the owner to be disposed.


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'.


SplashWindow

protected SplashWindow(java.awt.Frame owner)
Creates a splash window object using the specified frame.

Parameters:
owner - the owner.
Method Detail

createOwner

protected static final java.awt.Frame createOwner()
Creates the owner.

Returns:
the owner.

createComponentWindow

protected final 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 final 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 final 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.


dispose

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

Overrides:
dispose in class java.awt.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.