【发布时间】:2012-08-21 00:23:14
【问题描述】:
我正在尝试使用ElementListSelectionDialog。我遵循了示例代码,但无论出于何种原因,对话框都显示但没有选项
我的代码:
ElementListSelectionDialog dialog =
new ElementListSelectionDialog(shlSpriteCreator, new LabelProvider());
dialog.setMultipleSelection(false);
dialog.setIgnoreCase(true);
dialog.setAllowDuplicates(true);
dialog.setMessage("Select an AI");
dialog.setTitle("What AI to use?");
dialog.setElements(new String[]{"HELLO","GOODBYE"});
if (dialog.open() == Window.OK) {
aiControllerLocation = (String) dialog.getFirstResult();
}
结果对话框:
我最初使用了一个类数组,但由于它不起作用,我替换了一个琐碎的字符串列表,尽管据我所知,使用 LabelProvider 类我应该能够使用任何对象,它将显示为它是 toString() 表示。
【问题讨论】:
标签: java eclipse dialog swt jface