Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Scout/HowTo/3.8/Branding the Swing Client

< Scout‎ | HowTo‎ | 3.8

The Scout documentation has been moved to https://eclipsescout.github.io/.

This how-to describes how to brand the swing client.

All icons and images that will be referenced must be placed in the Swing client's resources/icons directory (e.g. org.eclipse.minicrm.ui.swing/resources/icons)

Scout-branding-swing-client-logo.png

This image is defined in the plugin org.eclipse.scout.rt.client in the folder resources/icons (logo.png). To exchange this image, put your image to the resources folder in your swing plugin (e.g. org.example.logo.ui.swing) and add the extension org.eclipse.scout.rt.ui.swing.scouticons (logo) that points to your image.

Scout-branding-swing-client-plugin.xml.png


Icons

Beside the logo, there are a other icons that can be exchanged that way, for example the tray icon. Use the context menu New on the org.eclipse.scout.rt.ui.swing.scouticons node to see the other possible entries.

Branding-Swing-Client-Icons-Extensions.png

The reason that you should supply icons for all different sizes is that they are used in many different places (Window title, Alt-Tab view on windows, task bar, etc). The result of the above configuration could look like this:

Branding-Swing-Client-Icons.png

Note: With the Rayo Look and Feel, the icon in the title bar will not be shown by default. To change this, add the following line to the Swing client's config.ini file:

scout.laf.useLafFrameAndDialog=false


Splash screen

Add the following member variable and methods to the class SwingEnvironment:

  private SwingIconLocator m_splashIconLocator;
  private static String SPLASH_FILE = "Splash"; // filename without extension

  @Override
  public void interceptUIDefaults(UIDefaults defaults) {
    // see UIDefaultsInjector
    super.interceptUIDefaults(defaults);
    defaults.put("Splash.icon", createIconUIResource(SPLASH_FILE));
  }
 
  private SwingIconLocator getIconLocator() {
    if (m_splashIconLocator == null) {
      /* this is the activator of your swing bundle containing your splash image */
      Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
      BundleIconLocator iconLocator = new BundleIconLocator(bundle);

      /* this is the folder inside the bundle given above specifying where to search for the images */
      iconLocator.getIconLocatorService().setFolderName("resources/icons");

      m_splashIconLocator = new SwingIconLocator(iconLocator);
    }
    return m_splashIconLocator;
  }

  private IconUIResource createIconUIResource(String resourceSimpleName) {
    Icon icon = getIconLocator().getIcon(resourceSimpleName);
    if (icon != null) {
      return new IconUIResource(icon);
    }
    else {
      return null;
    }
  }


Back to the top