Example usage for javax.swing DefaultComboBoxModel DefaultComboBoxModel

List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel

Introduction

In this page you can find the example usage for javax.swing DefaultComboBoxModel DefaultComboBoxModel.

Prototype

public DefaultComboBoxModel(Vector<E> v) 

Source Link

Document

Constructs a DefaultComboBoxModel object initialized with a vector.

Usage

From source file:com.peterbochs.instrument.InstrumentPanel.java

private JComboBox getJProfilingFromComboBox() {
    if (jProfilingFromComboBox == null) {
        ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] {});
        jProfilingFromComboBox = new JComboBox();
        jProfilingFromComboBox.setModel(jComboBox1Model);
        jProfilingFromComboBox.setEditable(true);

        new Thread() {
            public void run() {
                LinkedList<Long> vector = Setting.getInstance().getProfileMemoryFromAddress();
                Iterator<Long> iterator = vector.iterator();
                while (iterator.hasNext()) {
                    addProfileMemoryFromComboBox(iterator.next());
                }/*  www .j av  a  2s.  c o  m*/
            }
        }.start();
    }
    return jProfilingFromComboBox;
}

From source file:com.peterbochs.instrument.InstrumentPanel.java

private JComboBox getJProfilingToComboBox() {
    if (jProfilingToComboBox == null) {
        ComboBoxModel jComboBox2Model = new DefaultComboBoxModel(new String[] {});
        jProfilingToComboBox = new JComboBox();
        jProfilingToComboBox.setModel(jComboBox2Model);
        jProfilingToComboBox.setEditable(true);

        new Thread() {
            public void run() {
                LinkedList<Long> vector = Setting.getInstance().getProfileMemoryToAddress();
                Iterator<Long> iterator = vector.iterator();
                while (iterator.hasNext()) {
                    addProfileMemoryToComboBox(iterator.next());
                }/*from  w ww  .j  a  v  a 2s.c om*/
            }
        }.start();
    }
    return jProfilingToComboBox;
}

From source file:com.mirth.connect.connectors.ws.WebServiceSender.java

private void serviceComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serviceComboBoxActionPerformed
    String selectedPort = (String) portComboBox.getSelectedItem();

    if (currentServiceMap != null) {
        DefinitionPortMap portMap = currentServiceMap.getMap().get((String) serviceComboBox.getSelectedItem());

        if (portMap != null) {
            portComboBox.setModel(new DefaultComboBoxModel(portMap.getMap().keySet().toArray()));
        } else {//from  w  w  w.  j a v  a  2  s .co m
            portComboBox.setModel(new DefaultComboBoxModel());
        }
    }

    if (StringUtils.isNotBlank(selectedPort)) {
        portComboBox.setSelectedItem(selectedPort);
    } else if (portComboBox.getModel().getSize() > 0) {
        portComboBox.setSelectedIndex(0);
    }
}

From source file:com.mirth.connect.connectors.ws.WebServiceSender.java

private void portComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_portComboBoxActionPerformed
    if (currentServiceMap != null) {
        DefinitionPortMap portMap = currentServiceMap.getMap().get((String) serviceComboBox.getSelectedItem());

        if (portMap != null) {
            PortInformation portInformation = portMap.getMap().get((String) portComboBox.getSelectedItem());
            String selectedLocationURI = (String) locationURIComboBox.getSelectedItem();

            if (portInformation != null) {
                List<String> operationList = portInformation.getOperations();

                if (CollectionUtils.isNotEmpty(operationList)) {
                    String selectedOperation = (String) operationComboBox.getSelectedItem();
                    operationComboBox.setModel(new DefaultComboBoxModel(operationList.toArray()));

                    if (operationList.contains(selectedOperation)) {
                        operationComboBox.setSelectedItem(selectedOperation);
                    } else {
                        operationComboBox.setSelectedIndex(0);
                    }/*from w  w w  . j a  v  a 2 s . c o  m*/

                    generateEnvelope.setEnabled(!isDefaultOperations());
                } else {
                    operationComboBox.setModel(new DefaultComboBoxModel());
                }

                if (StringUtils.isNotBlank(portInformation.getLocationURI())) {
                    locationURIComboBox.setModel(
                            new DefaultComboBoxModel(new String[] { portInformation.getLocationURI() }));
                } else {
                    locationURIComboBox.setModel(new DefaultComboBoxModel());
                }
            } else {
                locationURIComboBox.setModel(new DefaultComboBoxModel());
                operationComboBox.setModel(new DefaultComboBoxModel());
            }

            if (StringUtils.isNotBlank(selectedLocationURI)) {
                locationURIComboBox.setSelectedItem(selectedLocationURI);
            }
        }
    }
}

From source file:org.biojava.bio.view.MotifAnalyzer.java

private JComboBox getSpeciesType() {
    if (organismType == null) {
        ComboBoxModel speciesTypeModel = new DefaultComboBoxModel(OrganismCode.getNames());
        organismType = new JComboBox();
        organismType.setModel(speciesTypeModel);
    }/* w  w w.j  a v  a  2s . co  m*/
    return organismType;
}

From source file:com.peterbochs.instrument.InstrumentPanel.java

private JComboBox getJNoOfLineComboBox() {
    if (jNoOfLineComboBox == null) {
        ComboBoxModel jNoOfLineComboBoxModel = new DefaultComboBoxModel(
                new String[] { "20", "50", "100", "200" });
        jNoOfLineComboBox = new JComboBox();
        jNoOfLineComboBox.setModel(jNoOfLineComboBoxModel);
        jNoOfLineComboBox.setEditable(true);
        jNoOfLineComboBox.setPreferredSize(new java.awt.Dimension(153, 22));
        jNoOfLineComboBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                jNoOfLineComboBoxActionPerformed(evt);
            }//from w w  w  .j  a  va 2 s .co  m
        });
    }
    return jNoOfLineComboBox;
}

From source file:com.proyecto.vista.MantenimientoInventario.java

private void cargarComboEstado() {
    List<String> estado = new ArrayList();
    estado.add("BUENO");
    estado.add("REGULAR");
    estado.add("MALO");
    cmbEstado.setModel(new DefaultComboBoxModel(estado.toArray()));
}

From source file:org.biojava.bio.view.MotifAnalyzer.java

private JComboBox getDatasetComboBox() {
    if (datasetComboBox == null) {
        ComboBoxModel datasetComboBoxModel = new DefaultComboBoxModel(Dataset.values());
        datasetComboBox = new JComboBox();
        datasetComboBox.setModel(datasetComboBoxModel);
    }/*from  w ww.  j ava2s . co m*/
    return datasetComboBox;
}

From source file:org.biojava.bio.view.MotifAnalyzer.java

private JComboBox getDatasetTypeComboBox() {
    if (datasetTypeComboBox == null) {
        ComboBoxModel datasetTypeModel = new DefaultComboBoxModel(DatasetType.values());
        datasetTypeComboBox = new JComboBox();
        datasetTypeComboBox.setModel(datasetTypeModel);
    }//from  www  .  j  av a  2s  .  c  o m
    return datasetTypeComboBox;
}

From source file:org.biojava.bio.view.MotifAnalyzer.java

private JComboBox getClusteringEpsilon() {
    if (clusteringEpsilon == null) {
        String[] range = new String[20];
        double c = 0;
        for (int i = 0; i < range.length; i++, c += 0.05)
            range[i] = String.format("%.2f", c);
        ComboBoxModel clusteringEpsilonModel = new DefaultComboBoxModel(range);
        clusteringEpsilon = new JComboBox();
        clusteringEpsilon.setModel(clusteringEpsilonModel);
        clusteringEpsilon.setSelectedIndex(16);
    }/*from  w w  w  .  j a va 2  s  . c o  m*/
    return clusteringEpsilon;
}