A dialog displaying multiple choices for SWT
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
jars
lib
media
src/main/de/linearbits/swt/choicesdialog
.gitignore
LICENSE
README.md
build.xml

README.md

SWT Choices Dialog

This project implements a dialog for SWT in which users may choose from one of several options. It is inspired by the DialogBox provided by the Opal project. In contrast to their implementation the dialog provided by this project uses the native widgets of the respective platform and it supports keyboard interactions.

Example

This basic example displays the a dialog box with three options:

// Create choices
ChoiceItem[] items = new ChoiceItem[]{
	new ChoiceItem("Exit and save my project", "Save your work in progress and exit the program"),
	new ChoiceItem("Exit and don't save", "Exit the program without saving your project"),
	new ChoiceItem("Don't exit", "Return to the program"),
};

// Create dialog
ChoicesDialog dialog = new ChoicesDialog(shell, SWT.APPLICATION_MODAL);

// Configure
dialog.setTitle("Exit");
dialog.setMessage("Do you really want to exit?");
dialog.setImage(Display.getCurrent().getSystemImage(SWT.ICON_QUESTION));
dialog.setChoices(items);
dialog.setDefaultChoice(2);

// Open
int choice = dialog.open();

// Cancel
if (choice == -1) {

// Choice selected, will be one of {0,1,2}
} else {

}

The above code will result in the following dialog:

Screenshot

Download

A binary version (JAR file) is available for download here.

The according Javadoc is available for download here.

Documentation

Online documentation can be found here.

License

EPL 1.0