List of usage examples for javax.swing ComboBoxModel getSize
int getSize();
From source file:richtercloud.reflection.form.builder.components.AmountMoneyPanel.java
/** * Not even {@link DefaultComboBoxModel} has a "contains" method. * @param currency//from w w w .ja va 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 {// w w w .jav a2 s . com if (in.getId().equals(id)) { return in; } } } return null; }
From source file:view.AppearanceSettingsDialog.java
private void updateSettings(String font, boolean bold, boolean italic) { ComboBoxModel model2 = (ComboBoxModel) cbFontType.getModel(); for (int i = 0; i < model2.getSize(); i++) { if (cbFontType.getItemAt(i).toString().equalsIgnoreCase(FontFactory.getFont(font).getFamilyname())) { cbFontType.setSelectedIndex(i); }/* w w w . j av a2s. co m*/ } cbBold.setSelected(bold); cbItalic.setSelected(italic); }