Three Ways to Preview New Look And Feel

Author: Yun XUAN (Yun.XUAN@easynth.com)

Date: 2009.01.15

Source: http://www.easynth.com


By using EaSynth Look And Feel Designer, you can design your own look and feel from scratch, or customize your look and feel on top of EaSynth Look And Feel. EaSynth Look And Feel Designer also provides some approaches to preview your new look and feel.

1. Preview Editing Style in Preview Region

During the development, we can preview the editing style in the preview region on the right. The image below is an example of previewing the button style, we can configure some properties of the previewing button, we can set the button enabled / disabled, focusable / un-focusable or set the button as the default button, and check its appearance on each state.

2. Preview All Styles in the "Synthetic Effect View"

Some swing components are composite component, they are consist of some other components. For example, a JComboBox component is consist of arrow button, JPopupMenu, JList, JScrollPane. In order to preview the composite component, we need to apply several styles on the component at a time; it can not be done in the preview region mentioned above.

There is a view named "Synthetic Effect View", which is not shown by default. We can click the button to show it. This view can preview all components with all available styles. The figure is an example of previewing the JComboBox.

3. Preview Look And Feel in External Java Applications

Sometimes we want to preview the editing look and feel in an external application. For example, we want to preview the look and feel before really integrate it into our product, what should we do? EaSynth Look And Feel Designer provides an interesting feature, which allows previewing the look and feel in an external Java application. You can launch it from menu "Look And Feel->Look And Feel Preview...", or just click the button on the toolbar.

There is a predefined setting for previewing look and feel in SwingSet2; you can launch it to see how your new look and feel works. But if you want to preview your look and feel on your own application, you need to make a new setting for it. The figure below is an example; we created a new setting named "ProFriend" to launch our ProFriend application.

The target file is the jar file or .class file that contains the main class, the main class can be chosen from a list or input manually.

The class path field should be fulfilled with the needed jar files. You can use the absolute file path or relative path when the working directory is specified. The file names should be separated by semicolon (in Windows) or colon (in Linux / UNIX).

In the example, the class path field is:
commons-lang-2.4.jar;commons-logging-1.1.1.jar;EaSynthLookAndFeel.jar;log4j-1.2.15.jar;profriend-client.jar;profriend-common.jar

The program arguments will be stored in the args[] array in the main() method, which can be used by the target application, but we don't use them in the example, so it is empty.

In the example, the VM arguments are:
-Xms100m -Xmx300m -Duser.language=en -Duser.dir="C:\Program Files\EaSynth\ProFriend\lib"
Here we set the current working directory to "C:\Program Files\EaSynth\ProFriend\lib", so the class path can use the relative path.

You can configure your own settings to launch your application, so that you can preview the new look and feel without modifying your product at this time.