JComboBox cb = new JComboBox(dbRecipeNames.toArray()); cb.setEditable(false); JPanel panel = new JPanel(); panel.add(new JLabel("Select Recipe:")); panel.add(cb); int result = JOptionPane.showConfirmDialog(null, panel, "Recipe", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result != JOptionPane.OK_OPTION)
Object[] selectedRecipes = Util.getObjectsFromList(this, new ArrayList(dbRecipeNames), "Recipes", "Select Recipes"); if (selectedRecipes == null)
  protected void selectRecipeFromDatabase() {    Map recipeNamesHT = helper.getRecipeNamesFromDatabase();    Set dbRecipeNames = recipeNamesHT.keySet();    if (dbRecipeNames.isEmpty()) {      JOptionPane.showMessageDialog(this,                                    "There are no recipes in the database",                                    "No Database Recipes",                                    JOptionPane.INFORMATION_MESSAGE);      return;    }    JComboBox cb = new JComboBox(dbRecipeNames.toArray());    cb.setEditable(false);    JPanel panel = new JPanel();    panel.add(new JLabel("Select Recipe:"));    panel.add(cb);    int result =       JOptionPane.showConfirmDialog(null, panel, "Recipe",                                    JOptionPane.OK_CANCEL_OPTION,                                    JOptionPane.PLAIN_MESSAGE);    if (result != JOptionPane.OK_OPTION)      return;    String recipeName = (String)cb.getSelectedItem();    String recipeId = (String) recipeNamesHT.get(recipeName);    if (recipeNames.contains(recipeName))      recipeName = recipeNames.getUniqueName(recipeName, false);    else      recipeName = recipeNames.getUniqueName(recipeName, true);    //    recipeName = recipeNames.getUniqueName(recipeName, false);    if (recipeName == null)      return;    // get name from user    // produce an unique name for CSMART if necessary//      if (recipeNames.contains(recipeName)) {//        recipeName = generateRecipeName(recipeName, false);//        if (recipeName == null)//          return;//      }    RecipeComponent rc = helper.getDatabaseRecipe(recipeId, recipeName);    if (rc != null)      addRecipeToWorkspace(rc, getSelectedNode());  }