5.1 Naming Your Application
Naming your application allows the operating system to distinguish it from other applications built with SWT. The implications of this vary between platforms but can include changing the default label used when your application windows are displayed as icons and controlling where window system-specific resource files are found.
You can name your application using this static Display method.
setAppName(String name)
Sets the name of the application to the argument.
On systems that use X resource files (notably, X Windows), the application name maps directly to an X Application Name. When set before creating the display (see the section Display Life Cycle), the application name will be used to find the X resources for your program, allowing you to change attributes, such as fonts and colors. For example, to tell X Windows to search for entries in its resource database of the form
Eclipse*<widget>.<resource>: <value>,
when creating the widgets for you application, you would use the following statement.
Display.setAppName("Eclipse");
Configuring widgets using an X resource file is common for X Windows applications and will not be further described here other than to say that SWT does not ship with a prebuilt resource file. This is deliberate; it ensures that SWT will use the default widget colors, fonts, and other properties configured for the operating system, rather than overriding them to be something that is unwanted.
If not specified, the default application name is SWT. It is worth changing this for any application you create.
|