Class JSplashScreen

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer

public final class JSplashScreen extends JWindow
The JSplashScreen class provides a splash screen for Swing-based GUIs.

Note that a valid I18NL10N database must be available!

When visible, the splash screen looks as follows:

As can be seen, there are three main areas:

  • An area where custom content can be shown.
    • The custom content is passed as a JLabel to the JSplashScreen object via its constructor. Typically, an image is provided; for visual coherence, we suggest using a JLabel/image with a maximum width of 500 pixels.
  • The common SMTools area (with the hammer and the spanner).
  • An area containing custom status messages and a progress bar.

When the splash screen is shown, an optional MP3 soundfile can be played.

Note that this class cannot be subclassed!

Version:
26/06/2018
Author:
Sven Maerivoet
See Also:
  • Constructor Details

    • JSplashScreen

      public JSplashScreen(JLabel customSplashScreenContent, InputStream mp3SoundInputStream)
      Constructs a JSplashScreen object with a specified content.

      When a JSplashScreen object should be created, but not be available, the caller should specify null as the value for the customSplashScreenContent.

      The caller should use null as the value for the MP3 soundFilename parameter if no MP3 soundfile is to be played.

      Important remark:

      • If the specified MP3 soundfile could not be played, it is ignored.
      Parameters:
      customSplashScreenContent - the custom content (typically an image with a maximum dimension of 460x130 pixels)
      mp3SoundInputStream - an InputStream containing the MP3 sound to be played (use null for no sound)
      See Also:
  • Method Details

    • isAvailable

      public boolean isAvailable()
      Returns whether or not the JSplashScreen object is available.

      This method returns false when no custom content was specified to the constructor.

      Returns:
      true when the JSplashScreen object is available, false otherwise
    • setStatusMessage

      public void setStatusMessage(String statusMessage)
      Changes the status message.
      Parameters:
      statusMessage - the status message
    • setStatusMessageWaitTime

      public void setStatusMessageWaitTime(int statusWaitTime)
      Sets the delay that is forced each time the status message is changed.
      Parameters:
      statusWaitTime - the time to wait (in milliseconds)
      See Also:
    • imageUpdate

      public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
      Prevents flickering when painting.
      Specified by:
      imageUpdate in interface ImageObserver
      Overrides:
      imageUpdate in class Component