Text On Splash Screen

You may have heard a variation of this at some point …

A lazy programmer is not necessarily a good programmer … but a good programmer is a lazy programmer.

I fully subscribe to that statement … good programmers are always looking for ways to make their jobs easier.  Either by automating some repetitive function or making some functionality easier to change in the future.

Recently I had to do some re-branding on one of my eclipse based applications.  One thing that I had to do was update the splash screen that was displayed in the Eclipse RCP to display different text.

We had the basic graphic and all we needed was to have our designer update the text that was displayed on the bottom.  I sent the graphic over and the new text and the designer sent it back to me.

The problem was, I got the text wrong.  I knew I was going to have to go back to the designer and ask her to redo the graphic.  Luckily she’s a very nice person and never had a problem with this.

But that got me thinking … what if I could overlay text on the graphic at runtime so I wouldn’t have to go back to the designer every time the text had to be updated.

I did a bit of digging and figured out a way to do it.

Example splash with text

First you have to register the splash handler class and bind it to the RCP product id.

This goes into the plugin.xml file:


Next you have the actual code …

[java highlight=”68,54″]package net.geekyramblings.rcp.splashHandlers;

import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.splash.AbstractSplashHandler;
import org.osgi.framework.Bundle;

* Display standard splash screen text while splash screen
* is displaying
public class TextOverlaySplashHandler
extends AbstractSplashHandler {

private Composite textPanel = null;

public TextOverlaySplashHandler() {
// nothing

private String getSplashText() {
String splashText = "This text will be displayed on " +
"the splash screen as it is shown";

return splashText;

public void init(final Shell splash) {
// Store the shell

// Configure the shell layout
// Create UI
// Force the UI to layout

// Keep the splash screen visible and prevent the RCP
// application from loading until the close button is
// clicked.

private void doEventLoop() {
// pause for 3 seconds so the text displays
try {
} catch (InterruptedException e) {
// nothing

private void createUI() {

Shell splash = getSplash();
// set background for Label text so it is transparent

// create a text panel positioned at the bottom center
// of the splash screen graphic.
textPanel = new Composite(splash, SWT.NONE);
textPanel.setLayoutData(new GridData(SWT.CENTER, SWT.END,

textPanel.setLayout(new GridLayout(1, true));

Label l = new Label(textPanel, SWT.NONE);
Display d = l.getDisplay();
Color white = d.getSystemColor(SWT.COLOR_BLACK);
l.setLayoutData(new GridData(SWT.CENTER, SWT.END,

private void configureUISplash() {
GridLayout layout = new GridLayout(1, true);

* @see org.eclipse.ui.splash.AbstractSplashHandler#dispose()
public void dispose() {



This example displays static text at the bottom of the splash screen image.

You can use standard SWT layout methods to style & position the text that’s being displayed.

Setting the background mode for the splash screen shell to SWT.INHERIT_DEFAULT (line 68) makes the background of the Label text transparent.

The logic in the doEventLoop() method (line 54) causes the splash screen to render and then wait 3 seconds so the text can be read.

One thing to be aware of … there is a pause between when the splash screen graphic is displayed and the text is overlayed.

If you want the splash screen text to come from a property file, you can use the standard methods … or, if you would like the text to come from the plugin.property file, you can use this technique…

[java]Bundle bundle = plugin.getBundle();

String splashText = Platform.getResourceString(bundle,

This code assumes you can get a handle to your plug-in object.  From the plug-in object, you get it’s Bundle, and using that you can get a resource string from the plugin.properties file. The entry in the property file would be:

splashText=This text will be displayed on the splash screen as it is shown

I always put in a static ‘getDefault()’ method in my plug-in class so I can easily get a handle to the singleton plug-in object.

Leave a Reply

Your email address will not be published. Required fields are marked *