Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Scout/HowTo/3.7/Add an icon"
Dev.jmini.fr (Talk | contribs) (java source + links) |
Dev.jmini.fr (Talk | contribs) |
||
Line 3: | Line 3: | ||
===== Add the icon file to the project ===== | ===== Add the icon file to the project ===== | ||
− | In the {{ScoutLink|Concepts|Shared Plug-In| | + | In the {{ScoutLink|Concepts|Shared Plug-In|client Plug-In}} (e.g. <code>tutorialMiniCrm.client.tutorialMiniCrm</code>) add the icon file to the <code>resources/icons</code> folder. |
Scout supports many different picture formats. You can use a PNG file that has a size of 16*16 pixels. | Scout supports many different picture formats. You can use a PNG file that has a size of 16*16 pixels. | ||
− | |||
===== Link your file to your application ===== | ===== Link your file to your application ===== | ||
− | Open the Icons class in the shared (e.g. tutorialMiniCrm.shared.tutorialMiniCrm.Icons) and add a new line like this: | + | Open the {{ScoutLink|Concepts|Icons|Icons class}} in the {{ScoutLink|Concepts|Shared Plug-In|shared}} (e.g. tutorialMiniCrm.shared.tutorialMiniCrm.Icons) and add a new line like this: |
<source lang="java"> | <source lang="java"> | ||
public static final String UserHome ="home_red"; | public static final String UserHome ="home_red"; | ||
</source> | </source> | ||
− | *Name of the constant is the name that you will use in your application. (e.g. UserHome) | + | * Name of the constant is the name that you will use in your application. (e.g. UserHome) |
− | *Value is the name of your file without the extension. (e.g. home_red.png) | + | * Value is the name of your file without the extension. (e.g. home_red.png) |
− | |||
===== Use your icon ===== | ===== Use your icon ===== | ||
Line 41: | Line 39: | ||
[[Image:IconChooser.png]] | [[Image:IconChooser.png]] | ||
+ | |||
+ | {{note|TODO|Add a section to describe the sub-icons: suffix on the image file to represent an other state (opened...)}} |
Revision as of 16:48, 31 August 2011
The Scout documentation has been moved to https://eclipsescout.github.io/.
Add the icon file to the project
In the The Scout documentation has been moved to https://eclipsescout.github.io/. (e.g. tutorialMiniCrm.client.tutorialMiniCrm
) add the icon file to the resources/icons
folder.
Scout supports many different picture formats. You can use a PNG file that has a size of 16*16 pixels.
Link your file to your application
Open the The Scout documentation has been moved to https://eclipsescout.github.io/. in the The Scout documentation has been moved to https://eclipsescout.github.io/. (e.g. tutorialMiniCrm.shared.tutorialMiniCrm.Icons) and add a new line like this:
public static final String UserHome ="home_red";
- Name of the constant is the name that you will use in your application. (e.g. UserHome)
- 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:
@Override protected String getConfiguredIconId(){ return Icons.UserHome; }
With the appropriate import:
import tutorialMiniCrm.shared.tutorialMiniCrm.Icons;
Of course the new icon is listed in the icon editor in the Scout SDK (The Scout documentation has been moved to https://eclipsescout.github.io/.: Project > Shared > Icons, The Scout documentation has been moved to https://eclipsescout.github.io/.: Open icons editor).
It is also available in the icon chooser field in order to configure quickly your GUI.