List of usage examples for javax.swing DefaultComboBoxModel addElement
public void addElement(E anObject)
From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java
private void setRoomModel() { this.invoiceList = this.invoiceController.selectNotEnabled(); final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); model.addElement("Seleccione uno..."); for (final Invoice invoice : this.invoiceList) { final Room room = invoice.getRoom(); model.addElement(room.getName()); }//from w w w .ja v a2 s. c o m this.jcbRoom.setModel(model); }
From source file:com.game.ui.views.ItemPanel.java
public void doGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel( "<html><div style='width : 500px;'>Pls select a value from the dropdown or you can create a new " + "entity below. Once selected an Item, its' details will be available below</div></html>"); noteLbl.setAlignmentX(0);/*from ww w . ja va 2 s .c o m*/ add(noteLbl); DefaultComboBoxModel model = new DefaultComboBoxModel(); if (ringPanel) { for (Item item : GameBean.ringDetails) { model.addElement(((Ring) item).getName()); } } else if (armourPanel) { for (Item item : GameBean.armourDetails) { model.addElement(((Armour) item).getName()); } } else if (potionPanel) { for (Item item : GameBean.potionDetails) { model.addElement(((Potion) item).getName()); } } else if (treasurePanel) { for (Item item : GameBean.treasureDetails) { model.addElement(((Treasure) item).getName()); } } doCommonStuffForDropDown(model); doCommonStuffForContent(); }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanelBase.java
/** * @param labelFor/* w w w . java 2s .com*/ * @return */ protected ValComboBox getIdCombobox(final String labelFor) { ValComboBox cbx = (ValComboBox) formViewObj.getControlByName("labelForCBX"); //$NON-NLS-1$ DefaultComboBoxModel model = (DefaultComboBoxModel) cbx.getModel(); model.addElement("None"); // I18N int inx = 0; if (StringUtils.isNotEmpty(labelFor)) { model.addElement(getNameForId(labelFor)); inx = 1; } for (FormCellField fcf : fieldsNotUsedByLabels) { model.addElement(fcf.getName()); } cbx.getComboBox().setSelectedIndex(inx); return cbx; }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanelBase.java
/** * @param imageName//from ww w . ja v a2 s.co m * @return */ protected ValComboBox processImageNameCBX(final String imageName) { List<Pair<String, ImageIcon>> icons = IconManager.getListByType("datamodel", IconManager.IconSize.Std16); //$NON-NLS-1$ ValComboBox cbx = (ValComboBox) formViewObj.getControlByName("imageNameCBX"); DefaultComboBoxModel model = (DefaultComboBoxModel) cbx.getModel(); model.addElement(getResourceString("EditorPropPanelBase.NONE")); //$NON-NLS-1$ int inx = 0; int cnt = 1; for (Pair<String, ImageIcon> iconPair : icons) { model.addElement(iconPair.first); if (StringUtils.isNotEmpty(imageName) && iconPair.first.equals(imageName)) { inx = cnt; } cnt++; } cbx.getComboBox().setSelectedIndex(inx); return cbx; }
From source file:io.github.jeddict.jpa.modeler.properties.named.nativequery.NamedNativeQueryPanel.java
private void initResultClassesModel() { resultClass_jComboBox.removeAllItems(); DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(null); entityMappings.getEntity().forEach(entity -> model.addElement(entity.getClazz())); resultClass_jComboBox.setModel(model); }
From source file:io.github.jeddict.jpa.modeler.properties.named.nativequery.NamedNativeQueryPanel.java
private void initResultSetMappingModel() { resultSetMapping_jComboBox.removeAllItems(); DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(null); entity.getSqlResultSetMapping().forEach(mapping -> model.addElement(mapping.getName())); resultSetMapping_jComboBox.setModel(model); }
From source file:eu.dety.burp.joseph.attacks.key_confusion.KeyConfusionInfo.java
@Override public boolean getExtraUI(JPanel extraPanel, GridBagConstraints constraints) { // Create combobox and textarea to add public key (in different formats) JLabel publicKeyLabel = new JLabel(bundle.getString("PUBKEY_FORMAT")); publicKeySelection = new JComboBox<>(); DefaultComboBoxModel<String> publicKeySelectionListModel = new DefaultComboBoxModel<>(); publicKey = new JTextArea(10, 50); publicKey.setLineWrap(true);/*from w w w . ja va 2 s .co m*/ publicKeySelectionListModel.addElement("PEM (String)"); publicKeySelectionListModel.addElement("JWK (JSON)"); publicKeySelection.setModel(publicKeySelectionListModel); constraints.gridy = 0; extraPanel.add(publicKeyLabel, constraints); constraints.gridy = 1; extraPanel.add(publicKeySelection, constraints); constraints.gridy = 2; JScrollPane jScrollPane = new javax.swing.JScrollPane(); jScrollPane.setViewportView(publicKey); extraPanel.add(jScrollPane, constraints); return true; }
From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java
private void setInvoiceStatusModel() { final InvoiceStatus statusNoPaid = invoiceStatusController.selectNoPaid(); final InvoiceStatus statusPaid = invoiceStatusController.selectPaid(); this.invoiceStatusList = new ArrayList<>(); this.invoiceStatusList.add(statusNoPaid); this.invoiceStatusList.add(statusPaid); final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); for (final InvoiceStatus invoiceStatus : this.invoiceStatusList) { model.addElement(invoiceStatus.getName()); }/*from ww w .j a v a 2 s. c o m*/ this.jcbAccountState.setModel(model); }
From source file:co.com.soinsoftware.hotelero.view.JFRoomPayment.java
private void validateBillToCompany(final Invoice invoice) { if (invoice.getCompany() != null) { if (!this.invoiceStatusList.contains(this.statusBillToCompany)) { this.invoiceStatusList.add(statusBillToCompany); }// w ww. ja v a 2 s .c o m } else { if (this.invoiceStatusList.contains(this.statusBillToCompany)) { this.invoiceStatusList.remove(statusBillToCompany); } } final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); for (final InvoiceStatus invoiceStatus : this.invoiceStatusList) { model.addElement(invoiceStatus.getName()); } this.jcbAccountState.setModel(model); }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanel.java
/** * @param labelFor// w w w . j ava 2 s . co m * @return */ protected ValComboBox getIdCombobox(final String labelFor) { ValComboBox cbx = (ValComboBox) formViewObj.getControlByName("labelForCBX"); //$NON-NLS-1$ DefaultComboBoxModel model = (DefaultComboBoxModel) cbx.getModel(); model.addElement(getResourceString("EditorPropPanel.NONE")); //$NON-NLS-1$ int inx = 0; if (StringUtils.isNotEmpty(labelFor)) { model.addElement(getNameForId(labelFor)); inx = 1; } for (FormCellField fcf : fieldsNotUsedByLabels) { model.addElement(fcf.getName()); } cbx.getComboBox().setSelectedIndex(inx); return cbx; }