List of usage examples for javax.swing ComboBoxModel getElementAt
E getElementAt(int index);
From source file:org.netbeans.jcode.rest.controller.RESTPanel.java
private void setAppPackage(String _package) { ComboBoxModel model = appPackageCombo.getModel(); for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i).toString().equals(_package)) { model.setSelectedItem(model.getElementAt(i)); break; }/*from www.j av a 2 s . c om*/ } ((JTextComponent) appPackageCombo.getEditor().getEditorComponent()).setText(_package); }
From source file:org.netbeans.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private void populatePackageCombo() { if (sourceGroup != null) { resourcePackageCombo.setRenderer(PackageView.listRenderer()); ComboBoxModel model = PackageView.createListView(sourceGroup); if (model.getSize() > 0) { model.setSelectedItem(model.getElementAt(0)); }/* w w w . j av a2 s .co m*/ resourcePackageCombo.setModel(model); } }
From source file:org.netbeans.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private void setPackage(String _package) { ComboBoxModel model = resourcePackageCombo.getModel(); for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i).toString().equals(_package)) { model.setSelectedItem(model.getElementAt(i)); return; }/*ww w . ja v a 2 s .c o m*/ } ((JTextComponent) resourcePackageCombo.getEditor().getEditorComponent()).setText(_package); }
From source file:org.zaproxy.zap.extension.quickstart.launch.LaunchPanel.java
public void postInit() { // Plugable browsers (like JxBrowser) can be added after this add-ons // options have been loaded String def = this.getExtQuickStart().getQuickStartParam().getLaunchDefaultBrowser(); if (def == null || def.length() == 0) { // no default return;/*from w ww .j av a 2s.c o m*/ } ComboBoxModel<ProvidedBrowserUI> model = this.getBrowserComboBox().getModel(); for (int idx = 0; idx < model.getSize(); idx++) { ProvidedBrowserUI el = model.getElementAt(idx); if (el.getName().equals(def)) { model.setSelectedItem(el); break; } } this.getContentPanel().add(getHudCheckbox(), LayoutHelper.getGBC(1, hudOffset, 3, 0.25D)); PlugableHud hud = getExtQuickStart().getHudProvider(); if (hud != null) { // Build up a model just with the browsers supported by the HUD List<ProvidedBrowserUI> hudBrowsers = new ArrayList<ProvidedBrowserUI>(); List<String> browserIds = hud.getSupportedBrowserIds(); for (int i = 0; i < allBrowserModel.getSize(); i++) { ProvidedBrowserUI browser = allBrowserModel.getElementAt(i); if (browserIds.contains(browser.getBrowser().getProviderId())) { hudBrowsers.add(browser); } } hudBrowserModel = new ProvidedBrowsersComboBoxModel(hudBrowsers); setBrowserOptions(this.getHudCheckbox().isSelected()); } }
From source file:richtercloud.reflection.form.builder.components.AmountMoneyPanel.java
/** * Not even {@link DefaultComboBoxModel} has a "contains" method. * @param currency/*from w ww . j av a 2 s.c o m*/ * @return {@code true} if {@code comboBoxModel} contains {@code currency}, * {@code false} otherwise */ private boolean comboBoxModelContains(ComboBoxModel<?> comboBoxModel, Currency currency) { for (int i = 0; i < comboBoxModel.getSize(); i++) { if (comboBoxModel.getElementAt(i).equals(currency)) { return true; } } return false; }
From source file:ro.nextreports.designer.querybuilder.RuntimeParametersPanel.java
private IdName findIdName(ComboBoxModel model, Serializable id) { // first element in combo model is a --select-- for (int i = 1, size = model.getSize(); i < size; i++) { IdName in = (IdName) model.getElementAt(i); if (in.getId() == null) { LOG.error("A value from select used in default values is null! and it is ignored"); } else {//from w ww .j a v a 2s.c o m if (in.getId().equals(id)) { return in; } } } return null; }