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:common.SwingGUI01.java

private void findMissionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findMissionButtonActionPerformed

    MissionsTableModel model = (MissionsTableModel) missionsTable.getModel();

    List<Mission> missions = model.getAllRows();
    findMissionDialogComboBox.setModel(new DefaultComboBoxModel(missions.toArray()));

    findMissionDialog.setVisible(true);/*  w  w w  .ja v  a  2  s.c  om*/
    findMissionDialog.getContentPane().setBackground(Color.GRAY);
}

From source file:common.SwingGUI01.java

private void findAgentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findAgentButtonActionPerformed

    //not neccessary call to findAllAgents(), too expensive DB operation if many records of agents are stored in DB
    AgentsTableModel model = (AgentsTableModel) agentsTable.getModel();

    List<Agent> agents = model.getAllRows();
    findAgentDialogComboBox.setModel(new DefaultComboBoxModel(agents.toArray()));

    findAgentDialog.setVisible(true);//  ww  w.  ja  va  2s  .com
    findAgentDialog.getContentPane().setBackground(Color.GRAY);
}

From source file:de.tor.tribes.ui.windows.TribeTribeAttackFrame.java

private void fireTransferAttacksToAttackViewEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fireTransferAttacksToAttackViewEvent
    List<Attack> results = getAllResults();
    if (results == null || results.isEmpty()) {
        showInfo("Keine Angriffe verfgbar", true);
        return;//  w w  w  .  j  a  v  a2  s. c o m
    }

    jExistingPlanBox.setModel(new DefaultComboBoxModel(AttackManager.getSingleton().getGroups()));
    jNewPlanName.setText(null);
    jResultTransferDialog.setLocationRelativeTo(jResultFrame);
    jResultTransferDialog.pack();
    jResultTransferDialog.setVisible(true);
}

From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java

/**
 * This method initializes jComboBox   /*  w w w  . j a va  2 s. co  m*/
 *    
 * @return javax.swing.JComboBox   
 */
private JComboBox getJComboBoxWorkflowStatus() {
    if (jComboBoxWorkflowStatus == null) {
        jComboBoxWorkflowStatus = new JComboBox<String>();
        jComboBoxWorkflowStatus
                .setModel(new DefaultComboBoxModel<String>(WorkFlowStatus.getWorkFlowStatusValues()));
        jComboBoxWorkflowStatus.setEditable(false);
        jComboBoxWorkflowStatus.setBackground(MainFrame.BG_COLOR_QC_FIELD);
        jComboBoxWorkflowStatus
                .setToolTipText(MetadataRetriever.getFieldHelp(Specimen.class, "WorkflowStatus"));
        AutoCompleteDecorator.decorate(jComboBoxWorkflowStatus);
    }
    return jComboBoxWorkflowStatus;
}

From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java

/**
 * This method initializes jComboBox   /*from ww w.  ja v  a  2 s .c  o m*/
 *    
 * @return javax.swing.JComboBox   
 */
private JComboBox getJComboBox2() {
    if (jComboBoxLocationInCollection == null) {
        jComboBoxLocationInCollection = new JComboBox<String>();
        jComboBoxLocationInCollection.setModel(
                new DefaultComboBoxModel<String>(LocationInCollection.getLocationInCollectionValues()));
        jComboBoxLocationInCollection.setEditable(false);
        jComboBoxLocationInCollection
                .setToolTipText(MetadataRetriever.getFieldHelp(Specimen.class, "LocationInCollection"));
        jComboBoxLocationInCollection.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent e) {
                thisPane.setStateToDirty();
            }
        });
        AutoCompleteDecorator.decorate(jComboBoxLocationInCollection);
    }
    return jComboBoxLocationInCollection;
}

From source file:common.SwingGUI01.java

private void assignAgentToMissionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assignAgentToMissionButtonActionPerformed

    //agents/*from  www.  j a  va2s  .co m*/
    AgentsTableModel agentsModel = (AgentsTableModel) agentsTable.getModel();

    List<Agent> agents = agentsModel.getAllRows();
    assignDialogAgentsComboBox.setModel(new DefaultComboBoxModel(agents.toArray()));

    //missions
    MissionsTableModel missionsModel = (MissionsTableModel) missionsTable.getModel();

    List<Mission> missions = missionsModel.getAllRows();
    assignDialogMissionsComboBox.setModel(new DefaultComboBoxModel(missions.toArray()));

    assignDialog.setVisible(true);
    findMissionDialog.getContentPane().setBackground(Color.GRAY);
}

From source file:common.SwingGUI01.java

private void withdrawAgentFromMissionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_withdrawAgentFromMissionButtonActionPerformed

    AgentsTableModel agentsModel = (AgentsTableModel) agentsTable.getModel();

    List<Agent> agents = agentsModel.getAllRows();
    withdrawAgentFromMissionAgentComboBox.setModel(new DefaultComboBoxModel(agents.toArray()));

    //missions// w w w.  ja  v  a 2  s  .  c om
    MissionsTableModel missionsModel = (MissionsTableModel) missionsTable.getModel();

    List<Mission> missions = missionsModel.getAllRows();
    withdrawAgentFromMissionMissionComboBox.setModel(new DefaultComboBoxModel(missions.toArray()));

    withdrawDialog.setVisible(true);
    findMissionDialog.getContentPane().setBackground(Color.GRAY);
}

From source file:common.SwingGUI01.java

private void findAgentsOnMissionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findAgentsOnMissionButtonActionPerformed

    MissionsTableModel missionsModel = (MissionsTableModel) missionsTable.getModel();

    List<Mission> missions = missionsModel.getAllRows();
    findAgentsOnMissionComboBox.setModel(new DefaultComboBoxModel(missions.toArray()));

    agentsOnMissionDialog.setVisible(true);
    findMissionDialog.getContentPane().setBackground(Color.GRAY);
}

From source file:common.SwingGUI01.java

private void findMissionWithAgentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findMissionWithAgentButtonActionPerformed

    AgentsTableModel agentsModel = (AgentsTableModel) agentsTable.getModel();

    List<Agent> agents = agentsModel.getAllRows();
    findMissionWithAgentComboBox.setModel(new DefaultComboBoxModel(agents.toArray()));

    missionWithAgentDialog.setVisible(true);
    findMissionDialog.getContentPane().setBackground(Color.GRAY);
}

From source file:common.SwingGUI01.java

private void findAvailableAgentsForMissionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findAvailableAgentsForMissionButtonActionPerformed

    MissionsTableModel missionsModel = (MissionsTableModel) missionsTable.getModel();

    List<Mission> missions = missionsModel.getAllRows();
    findAvailableAgentsComboBox.setModel(new DefaultComboBoxModel(missions.toArray()));

    availableAgentsDialog.setVisible(true);
    findMissionDialog.getContentPane().setBackground(Color.GRAY);
}