Swinging Task Dialog (part 3)


Following user requests several new features were added to the library this week.

i18n support

The Task Dialog library now has i18n support.  So  common text in the dialog can be shown in any language by supplying locale specific resource bundle named `task-dialog_<locale_id>.properties` and switching default locale. Library has built-in default and Spanish(es) bundles, which can be found under ‘src/main/resources’.

Customizable defaults

The defaults for resources (such as colors, fonts, icons) used by the library is stored in `UIDefaults`, same way as for any other Swing component.  This means the dialog can be customized by simply replacing these defaults with desired ones. Defaults are  set on the first use of `TaskDialog` class. List of keys can be found in `com.ezware.dialog.task.iDesign` interface.

New TaskDialogs.radioChoice methods

New`radioChoice` methods were added to `TaskDialogs` class. They provide almost a trivial way to request user selection based on a set of radio buttons. Here is an example

int choice = TaskDialogs.radioChoice("You've got selection to make", "Go ahead", 1, "Yes", "No", "May be" );

Partial support for OS specific look

This feature is not finished yet, but I made great inroads and can report on a status.

After doing research  into this topic I realized that there are significant differences not only in resources (fonts, icons, colors) used but actual layout of components in the dialog. This realization inspired internal design change which is based on concept of “dialog design” – a class responsible for all aspects of the dialog design. The appropriate design class is instantiated according to the underlying OS and is be used to create the dialog’s resources and layouts.

While creation of the  dialog layout is still work in progress, setting OS specific resources is pretty much done for Windows and Mac OS. Here is how the same dialog currently looks on Windows  and Mac OS X.

That is all I could accomplish this week. Further progress will be reported in the next installments of this series.

The project is available at http://code.google.com/p/oxbow/ under BSD license.
As always – comments and suggestions are welcome.

Advertisements

One comment

  1. Pingback: Prettier failures using Swing TaskDialog « Schneide Blog


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s