List of usage examples for javax.swing JComboBox addItem
public void addItem(E item)
From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java
/** * Create Generation Options Panel./*from w w w .j a va 2 s.com*/ * * @return generated panel */ protected JPanel createGenerationOptionsPanel() { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder("Script Generation Options")); GridLayout mgr = new GridLayout(3, 1); panel.setLayout(mgr); for (GenerationOption each : GenerationOption.getOptions(null)) { JExtendedCheckBox comp = new JExtendedCheckBox(each.name(), each.getDisplayName(), true); panel.add(comp); } JPanel subPanel = new JPanel(); subPanel.setLayout(new GridLayout(1, 2)); JLabel languageLabel = new JLabel("Language"); subPanel.add(languageLabel); JComboBox languageCombo = new JComboBox(); for (GenerationOption each : GenerationOption.getOptions("Language")) { languageCombo.addItem(each); } subPanel.add(languageCombo); panel.add(subPanel); return panel; }
From source file:org.openconcerto.erp.core.finance.accounting.element.AssociationCompteAnalytiqueSQLElement.java
public JTable creerJTable(ClasseCompte ccTmp) { final AssociationAnalytiqueModel model = new AssociationAnalytiqueModel(ccTmp); final JTable table = new JTable(model); final Vector vect = model.getRepartitionsAxe(); table.getColumnModel().getColumn(0).setCellRenderer(new PlanComptableCellRenderer(0)); table.getColumnModel().getColumn(1).setCellRenderer(new PlanComptableCellRenderer(0)); for (int i = 0; i < vect.size(); i++) { final Vector rep = (Vector) vect.get(i); JComboBox combo = new JComboBox(); for (int j = 0; j < rep.size(); j++) { combo.addItem(rep.get(j)); }/* ww w .ja v a 2 s. c om*/ table.getColumnModel().getColumn(i + 2).setCellEditor(new DefaultCellEditor(combo)); table.getColumnModel().getColumn(i + 2).setCellRenderer(new PlanComptableCellRenderer(0)); } table.getTableHeader().setReorderingAllowed(false); return table; }
From source file:org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjSavingDialog.java
/** * Takes the dataNdoes and populates the combo box with the values as well * as adding a tooltip for each item/* w ww. ja v a 2s . com*/ * * @param dataNodes the nodes used to be displayed in the combo box * @param comboBox the JComboBox that hosts the options */ private void populateAndAddTooltipsToComboBox(List<DataNode> dataNodes, JComboBox comboBox) { List<String> tooltips = new ArrayList<String>(dataNodes.size()); List<String> lines; ExperimenterData exp; for (DataNode n : dataNodes) { exp = getExperimenter(n.getOwner()); comboBox.addItem(n); lines = new ArrayList<String>(); if (exp != null) { lines.add("<b>Owner: </b>" + EditorUtil.formatExperimenter(exp)); } lines.addAll(UIUtilities.wrapStyleWord(n.getFullName())); tooltips.add(UIUtilities.formatToolTipText(lines)); } //To be modified. exp = ImViewerAgent.getUserDetails(); ComboBoxToolTipRenderer renderer = new ComboBoxToolTipRenderer(exp.getId()); comboBox.setRenderer(renderer); renderer.setTooltips(tooltips); }
From source file:org.smart.migrate.ui.MappingDialog.java
private void initTables(JComboBox comboBox, MetaDao metaDao, Connection connection) { comboBox.removeAllItems();//from www . ja v a 2 s. c om List<String> tables = metaDao.getTables(connection); for (String table : tables) { comboBox.addItem(table); } }
From source file:org.smart.migrate.ui.MappingDialog.java
private void initFieldMappings() { if (StringUtils.isBlank((String) cbxSourceTables.getSelectedItem()) || StringUtils.isBlank((String) cbxTargetTables.getSelectedItem())) { return;//from w ww. jav a 2 s .co m } DefaultTableModel model = (DefaultTableModel) tblFieldMapping.getModel(); model.setRowCount(0); TableColumn srcColumn = tblFieldMapping.getColumnModel().getColumn(0); TableColumn tgtColumn = tblFieldMapping.getColumnModel().getColumn(1); JComboBox srcComboBox = new JComboBox(); srcComboBox.setMaximumRowCount(20); List<Field> srcFields = sourceMetaDao.getFieldsOfTable(sourceConnection, cbxSourceTables.getSelectedItem().toString()); List<Field> tgtFields = targetMetaDao.getFieldsOfTable(targetConnection, cbxTargetTables.getSelectedItem().toString()); srcComboBox.addItem(""); for (Field field : srcFields) { srcComboBox.addItem(field.getName()); } srcColumn.setCellEditor(new DefaultCellEditor(srcComboBox)); int k = 0; for (Field tgtField : tgtFields) { k++; model.addRow(new Object[] { null, tgtField.getName(), false, null, null, k }); } if (tableSetting != null && !CollectionUtils.isEmpty(tableSetting.getFieldSettings()) && tableSetting.getSourceTable().equals(cbxSourceTables.getSelectedItem()) && tableSetting.getTargetTable().equals(cbxTargetTables.getSelectedItem())) { for (int i = 0; i < tblFieldMapping.getRowCount(); i++) { String tgtField = (String) tblFieldMapping.getValueAt(i, 1); FieldSetting fieldSetting = tableSetting.getFieldSettingByTargetField(tgtField); if (fieldSetting != null) { tblFieldMapping.setValueAt(fieldSetting.getSourceField(), i, 0); tblFieldMapping.setValueAt(fieldSetting.isPrimaryKey(), i, 2); tblFieldMapping.setValueAt(fieldSetting.getDefaultValue(), i, 3); tblFieldMapping.setValueAt(fieldSetting.getDictText(), i, 4); } } } }
From source file:org.smart.migrate.ui.MigrateMain.java
private void initDBTypes(JComboBox comboBox) { comboBox.removeAllItems();//w w w .j a v a 2s. c om for (DBType dBType : DBType.values()) { comboBox.addItem(dBType); } }
From source file:org.smart.migrate.ui.RelationDialog.java
private void initTables(JComboBox comboBox) { comboBox.removeAllItems();/*from w w w . ja va2 s . c o m*/ List<String> tables = migratePlan.getSourceTableNames(); for (String table : tables) { comboBox.addItem(table); } }
From source file:org.smart.migrate.ui.RelationDialog.java
private void initFields(JComboBox comboBox, String table) { comboBox.removeAllItems();//w w w . j a v a2 s .co m List<Field> fields = metaDao.getFieldsOfTable(connection, table); for (Field field : fields) { comboBox.addItem(field.getName()); } }
From source file:org.smart.migrate.ui.UpdateRelatePKDialog.java
private void initTables(JComboBox comboBox) { comboBox.removeAllItems();//from w w w. j a v a2 s. c o m List<String> tables = migratePlan.getTargetTableNames(); for (String table : tables) { comboBox.addItem(table); } }
From source file:org.smart.migrate.ui.UpdateRelatePKDialog.java
private void initFields(JComboBox comboBox, String table) { comboBox.removeAllItems();/* w ww . j av a 2 s .c o m*/ List<Field> fields = getMetaDao().getFieldsOfTable(getConnection(), table); for (Field field : fields) { comboBox.addItem(field.getName()); } }