HOME

com.ultraswing
Class SplashScreen

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.ultraswing.SplashScreen
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class SplashScreen
extends Canvas

A splash screen implementation.

Usage Example:

            SplashScreen splash = new SplashScreen("/images/splash.jpg", true);
            splash.setProgressBarColor(Color.gray, Color.blue);
            splash.start();
            for (int i = 0; i < 10 ; i++)
            {
                // do initialization .....
                splash.setProgress(10 * i);//total progress value is 100

                //Add sleep time because there's little to load for this demo, and we don't want splash disappear too quickly
                Thread.sleep(200);
            }
            splash.close();
 

See Also:
Serialized Form

Field Summary
 
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
SplashScreen(String imgFileURL, boolean showProgressBar)
          Creates a SplashScreen object
 
Method Summary
 void close()
          Closes splash screen
 Dimension getImageSize()
          Returns the image size
 int getProgress()
          Returns the progress bar's current value
 void paint(Graphics aoGraphics)
           
 void setProgress(int percent)
          Sets the progress bar value.
 void setProgressBarBounds(int x, int y, int width, int height)
          Sets the bounds of progress bar.
 void setProgressBarColor(Color background, Color barColor)
          Sets progress bar's colors.
 void start()
          Starts to show splash screen
 void update(Graphics aoGraphics)
           
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SplashScreen

public SplashScreen(String imgFileURL,
                    boolean showProgressBar)
Creates a SplashScreen object

Parameters:
imgFileURL - url of splash image
showProgressBar - if true, show progress bar on splash screen
Method Detail

getImageSize

public Dimension getImageSize()
Returns the image size


setProgressBarBounds

public void setProgressBarBounds(int x,
                                 int y,
                                 int width,
                                 int height)
Sets the bounds of progress bar.


setProgressBarColor

public void setProgressBarColor(Color background,
                                Color barColor)
Sets progress bar's colors.

Parameters:
background - progress bar's background color
barColor - progress bar's color

start

public void start()
Starts to show splash screen


close

public void close()
Closes splash screen


setProgress

public void setProgress(int percent)
Sets the progress bar value. The total value is 100.


getProgress

public int getProgress()
Returns the progress bar's current value


update

public void update(Graphics aoGraphics)
Overrides:
update in class Canvas

paint

public void paint(Graphics aoGraphics)
Overrides:
paint in class Canvas

HOME

Copyright © 2002 iReasoning Networks. All Rights Reserved.