TaskDialog




What is TaskDialog ?



TaskDialog is an Dialog User Interface for Java. TaskDialog look like Window Dialog. Task Dialog is presented by Eugene Ryzhikov.  Thank you to Eugene for such greate components.

Simple TaskDialog can be done by few lines :

TaskDialog dialog = new TaskDialog("TaskDialog");
dialog.setText("Hello Java !!");
dialog.show();
 








Icon can be set using following line :

dialog.setIcon(TaskDialog.StandardIcon.INFO);



Simple text footer added using  :

dialog.getFooter().setText("Footer is here !!!");





Also TaskDialog provide facility to add Icon to footer note.

dialog.getFooter().setIcon(TaskDialog.StandardIcon.WARNING);






TaskDialog having ability to add components in Footer like Checkbox.

dialog.getFooter().setCheckBoxText("Footer is Here !!!");




Another feature of TaskDialog is to adding your own components in TaskDialog.

dialog.setFixedComponent(/* your component is here */);

See below exaple adding an JComboBox in TaskDialog.

dialog.setFixedComponent(
                 new JComboBox(new String[]{"Item1","Item2","Item3"}));






Adding Details in TaskDialog

dialog.getDetails().setExpandableComponent(
new JLabel("You can set your details here !!!"));




Complex TaskDialog



Waiting TaskDialog

Waiting TaskDialog is an new contect provided my Author.  TaskDialog can wait for perticular duration.

TaskDialogs.warn("Are you sure@@15", "Register your product.");






You append duration in instruction of TaskDialog with following @@ symbol.



Choice TaskDialog

Choise TaskDialog is an advance graphical user interface swing control provided author.
It look like vista or seven dialog. In this TaskDialog we able to provide all option with Icons/Images.



Choise (Option) for this TaskDialog is provided using an CommandLink. CommandLink is an very Simple API to use. To create an CommandLink you need to provide an three arguments : First is Icon. Icon is an optional argument for CommandLink. Second is Instruction String and Third is Text for CommandChoice for TaskDialog.

CommandLink link = new CommandLink(TaskDialog.StandardIcon.ERROR,
"Error",
                        "Select Error option for display error.");


It look like as:



To add an multiaple choise (option) in the TaskDialog use Collection like Vector,List…

Vector<CommandLink> vector = new Vector<CommandLink> ();

CommandLink link1 =  new CommandLink("Save & Exit",
  "Save your document first and then exit application.");
CommandLink link2 =  new CommandLink("Don't Save",
                    "Exit application without saving documents.");
CommandLink link3 =  new CommandLink("Cancel","");

vector.add(link1);
vector.add(link2);
vector.add(link3);
      
TaskDialogs.choice("Are you sure?",
                   "Do you want to save changes.", 0, vector);


It look liks :




If you do not give an icon choice is followed by an green arrow as show in above figure.

Radiochoice TaskDialog

For Radiochoice TaskDialog you nedd to pass an only String in place of CommandLink

Vector<String>  vector = new Vector<String>();

Vector.add(“Asia”);
Vector.add(“Africa”);
Vector.add(“North America”);
Vector.add(“South America”);
Vector.add(“Europe”);

TaskDialogs.radioChoice(
             "Select your region",
             "Select your are from which continents",
             0,
             vector);

No comments:

Post a Comment