Sunday, March 7, 2010

Swinging Task Dialog (part 2)

This week's focus was on adding more functionality.
The API was extended with an ability to set commands (buttons on the bottom of the dialog). TaskDialog features a set of standard commands ( currently only Ok and Cancel ). But it is very easy to add any arbitrary command. The only requirement is that the command has to implement TaskDialog.Command interface.
TaskDialog's getResult() method returns last executed command. A simpler way to use it is show() method which shows the dialog and returns last executed command. Here is a warning dialog:


Sometimes custom command has to not just close the dialog but execute some additional logic.  To accomplish this PropertyChangeListener can be attached to the TaskDialog's "result" property. As soon as result changes (command button is pressed ) your code will be notified.
It is possible now to add any fixed component to the dialog ( in addition to expandable one ). Here is the example of the  dialog with the progress bar.


More work is required in the area as I want to to provide prebuilt components such as command links. To even further simplify usage I added TaskDialogs class. It makes creation of certain task dialogs a one liner.

The above code produces three task dialogs:


The project is available at under BSD license.
As always - comments and suggestions are welcome.


  1. Java desktop links of the week, March 15 | Jonathan GilesMarch 24, 2013 at 11:16 AM

  2. We suggest you hire a custom software program supplier as a result of|as a outcome of} they'll develop a highly customizable and tailor-made product. You can control 바카라사이트 the complete growth process, apply changes when needed, and get a cutting-edge ultimate product. You can learn extra about numerous online on line casino options at InnovecsGaming. Today, everybody can start online on line casino enterprise when having the necessary funding in place, but not all newbies realize the majority of of} pitfalls that might happen. It’s recommended to discover a reliable partner to build and operate a robust enterprise.