/** * Fills a combo box with a list of miraclegrue profiles * * @param comboBox to fill with list of miraclegrue profiles */ private void loadList(JComboBox comboBox) { comboBox.removeAllItems(); profiles = parentGenerator.getProfiles(); DefaultComboBoxModel model = new DefaultComboBoxModel(); int i = 0; int foundLastProfile = -1; for (MgProfile p : profiles) { // Check that this profile says it's for this machine if (ProfileUtils.shouldDisplay(p)) { model.addElement(p.toString()); if (p.toString().equals(Base.preferences.get("lastGeneratorProfileSelected", "---"))) { Base.logger.fine("Selecting last used element: " + p); foundLastProfile = i; } i++; } } comboBox.setModel(model); if (foundLastProfile != -1) { comboBox.setSelectedIndex(foundLastProfile); } }