Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Scout/HowTo/3.9/Add an icon

< Scout‎ | HowTo‎ | 3.9

The Scout documentation has been moved to

Add the Icon File to the Project

In the The Scout documentation has been moved to (e.g. org.eclipse.scout.helloworld.client) add the icon file to the resources/icons folder.

Scout supports many different picture formats. You can e.g. use a PNG file that has a size of 16*16 pixels.

Link your File to the Application

Open the The Scout documentation has been moved to in the The Scout documentation has been moved to (e.g. org.eclipse.scout.helloworld.shared.Icons) and add a new line like this:
public static final String UserHome = "home_red";
  • The name of the constant is the name that you will use in your application. (e.g. UserHome)
  • The value is the name of your file without the extension. (e.g. home_red.png)

Use your icon

When you need to provide an Icon you can now use the Icons class. For example:
protected String getConfiguredIconId() {
  return Icons.UserHome;
With the appropriate import:
import org.eclipse.scout.helloworld.shared.Icons;
Of course the new icon is listed in the icon editor in the Scout SDK (The Scout documentation has been moved to Project > Shared > Icons, The Scout documentation has been moved to Open Icons Editor).


It is also available in the icon chooser field in order to configure quickly your UI.


Eclipse Scout supports sub-icons for some states. Sub-icons are defined with their suffix:

  • _open: for expanded / collapsed node-state (for example for pages in the page tree).
  • _mouse_over or _rollover: for hoover effect on buttons (e.g. ToolButton)
  • _active or _pressed or _selected: for pressed-state on buttons (e.g. ToolButton with toggle action)
  • _disabled: for disabled icons

If no such icons are provided for the given state, the fallback icon without suffix is used instead. For disabled state, the icon is simply greyed out if missing.

Providing an IconProviderService

Normally an internal icon service provider is used to resolve images and icons in your client. However, if you explicitely provide a CustomIconProviderService as described in the how-to Display_images_in_a_table_page, this new service will replace the internal service. This means, that the above mechanism to show icons will no longer work, because the CustomIconProviderService will be used, which will not find those icons.

The solution to this problem is to add another IconProviderService to resovle these icons.

Create a new class ClientIconProviderService in your client plugin:

import org.eclipse.minicrm.client.Activator;

public class ClientIconProviderService extends IconProviderService {
  public ClientIconProviderService() {
  public int getRanking() {
    return -20;

  public IconSpec getIconSpec(String iconName) {
    IconSpec result = super.getIconSpec(iconName);
    return result;

In your client's plugin.xml add the following code (the same place where you already added the CustomIconProviderService):


You should now be able to use both the custom icons described above as well as the table icons described in the linked how-to.

Back to the top