JOptionPane.showMessageDialog(parentComponent, message, title,
JOptionPane.ERROR_MESSAGE);
return Collections.EMPTY_LIST;
}
CheckboxList cbl = new CheckboxList(taskLists.toArray());
if (preselectedNames != null) {
for (int i = 0; i < taskLists.size(); i++) {
if (preselectedNames.contains(taskLists.get(i).taskListName))
cbl.setChecked(i, true);
}
}
JScrollPane sp = new JScrollPane(cbl);
sp.getViewport().setBackground(cbl.getBackground());
sp.setPreferredSize(new Dimension(200, 200));
Object message = new Object[] {
resources.getString("Forecast_Ranges.Historical_Data.Prompt"), sp };
if (JOptionPane.showConfirmDialog(parentComponent, message,
resources.getString("Forecast_Ranges.Historical_Data.Window_Title"),
JOptionPane.OK_CANCEL_OPTION) != JOptionPane.OK_OPTION)
return null;
Object[] selections = cbl.getCheckedItems();
List<String> result = new ArrayList<String>(selections.length);
for (int i = 0; i < selections.length; i++) {
result.add(((TaskListSelection) selections[i]).taskListName);
}
return result;