NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #677 (closed enhancement: fixed)

Opened 2011-07-21T16:41:02-05:00

Last modified 2011-07-21T16:41:13-05:00

Generalized Dialog Box

Reported by: gharris Owned by: gharris
Priority: major Milestone: biweekly-2011: Jul-18 to Jul-29
Component: UI Framework Version:
Severity: major Keywords:
Cc: Blocked By:


Generalized Dialog Box

Added an interface DialogPrompt.
Added a SwingDialogPrompt implementation.
Added to imagej.ui.UserInterface a method,

DialogPrompt dialogPrompt(String message, String title,
DialogPrompt.MessageType msg, DialogPrompt.OptionType option);

So, to prompt the user for a yes/no/cancel or confirmation dialog,
do this:

final UserInterface ui = ImageJ.get(UIService.class).getUI();
DialogPrompt dialog = ui.dialogPrompt("Message", "Title",


DialogPrompt.Result result = dialog.prompt();
if (result == DialogPrompt.Result.YES_OPTION) {

System.out.println("That's a YES");


The plugin imagej.ui.swing.plugins.debug.TestDialogPrompt (menu: Plugins::Debug::TestDialogPrompt) demonstrates it use.

Change History

comment:1 Changed 2011-07-21T16:41:13-05:00 by gharris

  • Status changed from new to closed
  • Resolution set to fixed