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() 

Source Link

Document

Constructs an empty DefaultComboBoxModel object.

Usage

From source file:atlas.kingj.roi.FrmMain.java

private void DisableProdForm() {
    results = null;//from   w w  w  . ja va  2  s.  com

    pnlGraph.setVisible(false);
    picLabel.setVisible(true);
    btnSaveToFile.setEnabled(false);
    btnShowGraph.setEnabled(false);
    btnShowTimings.setEnabled(false);
    lblPreview.setEnabled(false);
    lblType.setEnabled(false);
    cmbGraphType.setEnabled(false);
    lblMachine.setEnabled(false);
    lblPer.setEnabled(false);
    lblOutputWeight.setEnabled(false);
    lblOutputLength.setEnabled(false);
    lblAverageMmin.setEnabled(false);
    lblEfficiency.setEnabled(false);
    lblscheduletime.setEnabled(false);
    lblscheduletimelbl.setEnabled(false);
    cmbMachines.setEnabled(false);
    cmbTimeRef.setEnabled(false);
    lblNumericsEff.setEnabled(false);
    lblNumericsLength.setEnabled(false);
    lblNumericsWeight.setEnabled(false);
    lblNumericsRate.setEnabled(false);
    btnDowntime.setEnabled(false);
    lblbreakdown1.setEnabled(false);
    lblbreakdown2.setEnabled(false);
    cmbMachines.setModel(new DefaultComboBoxModel());
    lblNumericsEff.setText("0.0 %");
    lblscheduletime.setText("0.0 hr");
    lblNumericsLength.setText((metric ? "0.0 m" : "0.0 ft"));
    lblNumericsWeight.setText((metric ? "0.0 kg" : "0.0 tons"));
    lblNumericsRate.setText((metric ? "0.0 m/hr" : "0.0 ft/hr"));
}

From source file:nz.govt.natlib.ndha.manualdeposit.dialogs.ApplicationProperties.java

private void setupForm(final String settingsPath) {
    this.setTitle("System Properties");
    try {/*ww w  .j ava 2s  .  c  o  m*/
        theFormControl = new FormControl(this, settingsPath);
    } catch (Exception ex) {
        LOG.error("Error loading form parameters", ex);
    }
    // Set fonts
    isSystemChange = true;
    final GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    final Font[] fonts = env.getAllFonts();
    DefaultListModel model = new DefaultListModel();
    for (int i = 0; i < fonts.length; i++) {
        final Font font = fonts[i];
        model.add(i, font.getName());
    }
    lstFont.setModel(model);

    // Set styles
    model = new DefaultListModel();
    model.addElement("Plain");
    model.addElement("Bold");
    model.addElement("Italic");
    model.addElement("Bold Italic");
    lstStyle.setModel(model);

    // Set sizes
    model = new DefaultListModel();
    model.addElement("8");
    model.addElement("10");
    model.addElement("12");
    model.addElement("14");
    model.addElement("18");
    model.addElement("20");
    model.addElement("22");
    model.addElement("24");
    lstSize.setModel(model);
    txtFontSize.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(final DocumentEvent e) {
            updateFontSize();
        }

        public void removeUpdate(final DocumentEvent e) {
            updateFontSize();
        }

        public void insertUpdate(final DocumentEvent e) {
            updateFontSize();
        }
    });

    model = new DefaultListModel();
    for (String favourite : personalSettings.getFavourites()) {
        model.addElement(favourite);
    }
    lstFavourites.setModel(model);

    model = new DefaultListModel();
    for (PersonalSettings.FileDescriptions descriptions : personalSettings.getFilesToIgnore()) {
        model.addElement(descriptions);
    }
    lstFilesToIgnore.setModel(model);

    final DefaultComboBoxModel cmbModel = new DefaultComboBoxModel();
    for (PersonalSettings.TextPosition position : PersonalSettings.TextPosition.values()) {
        cmbModel.addElement(position);
    }
    cmbTextPosition.setModel(cmbModel);

    chkSortRunning.setSelected(personalSettings.isSortRunningAscending());
    chkSortPending.setSelected(personalSettings.isSortPendingAscending());
    chkSortFailed.setSelected(personalSettings.isSortFailedAscending());
    chkSortDeposited.setSelected(personalSettings.isSortDepositedAscending());
    chkSortComplete.setSelected(personalSettings.isSortCompleteAscending());
    txtNoOfRetries.setText(String.format("%d", personalSettings.getNoOfRetries()));

    isSystemChange = false;
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

public void addUserGroupHandlers(JLabel lblCleanupDirectory, JLabel lblDelay, JTextField txtCleanupDelay,
        JComboBox cmbCleanupType, JList lstCharacterTranslations, JComboBox cmbCharacterPosition,
        JTextField txtTranslateFrom, JTextField txtTranslateTo, JComboBox cmbUserGroupDesc) {
    theLblCleanupDirectory = lblCleanupDirectory;
    theLblDelay = lblDelay;//  w w  w  . jav  a 2  s. co m
    theTxtCleanupDelay = txtCleanupDelay;
    theCmbCleanupType = cmbCleanupType;
    theLstCharacterTranslations = lstCharacterTranslations;
    theCmbCharacterPosition = cmbCharacterPosition;
    theTxtTranslateFrom = txtTranslateFrom;
    theTxtTranslateTo = txtTranslateTo;
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (UserGroupData.ECleanupType cleanupType : UserGroupData.ECleanupType.values()) {
        model.addElement(cleanupType);
    }
    theCmbCleanupType.setModel(model);
    theCmbCleanupType.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cmbCleanupTypeActionPerformed(evt);
        }
    });
    theCmbUserGroupDesc = cmbUserGroupDesc;
    model = new DefaultComboBoxModel();
    for (UserGroupData.UserGroupDesc userGroupDesc : UserGroupData.UserGroupDesc.values()) {
        model.addElement(userGroupDesc);
    }
    theCmbUserGroupDesc.setModel(model);
    theCmbCharacterPosition = cmbCharacterPosition;
    model = new DefaultComboBoxModel();
    for (UserGroupData.ECharacterPosition charPosition : UserGroupData.ECharacterPosition.values()) {
        model.addElement(charPosition);
    }
    theCmbCharacterPosition.setModel(model);
    DefaultListModel translationModel = new DefaultListModel();
    theLstCharacterTranslations.setModel(translationModel);
    loadTranslations();
    theLstCharacterTranslations.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            characterTranslationValueChanged(evt);
        }
    });
    theTxtTranslateFrom.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            userGroupCaretUpdate(evt);
        }
    });
    theTxtTranslateTo.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            userGroupCaretUpdate(evt);
        }
    });
    checkCleanupItems();
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

public void addMetaDataHandlers(JList dataList, JComboBox dataTypeCombo, JPanel dataLookupFrame,
        JList dataTypeListItems, JList cmsMappingsList, JComboBox cmsFieldCombo, JList dnxTypeList,
        JList dnxDetailList, JList dcTypeList, JList dcXsiList, JList dcTermsTypeList, JTabbedPane dnxDcPane) {
    theDataList = dataList;/*from   ww  w . ja  va  2  s  .  c  o  m*/
    theDataList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dataListValueChanged(evt);
        }
    });
    theCmbDataType = dataTypeCombo;
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (EDataType dataType : EDataType.values()) {
        model.addElement(dataType);
    }
    theCmbDataType.setModel(model);
    theCmbDataType.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            cmbDataTypeActionPerformed(evt);
        }
    });
    theDataLookupFrame = dataLookupFrame;
    theDataLookupList = dataTypeListItems;
    DefaultListModel listModel = new DefaultListModel();
    theDataLookupList.setModel(listModel);
    theDataLookupList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dataLookupListValueChanged(evt);
        }
    });
    theCmsMappingsList = cmsMappingsList;
    listModel = new DefaultListModel();
    theCmsMappingsList.setModel(listModel);
    theCmsMappingsList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            cmsMappingListValueChanged(evt);
        }
    });
    theDnxTypeList = dnxTypeList;
    theDnxTypeList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dnxTypeListValueChanged(evt);
        }
    });
    theCmsFieldCombo = cmsFieldCombo;
    tehDnxDetailList = dnxDetailList;
    tehDnxDetailList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dnxDetailListValueChanged(evt);
        }
    });
    theDcTypeList = dcTypeList;
    theDcTypeList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dcTypeListValueChanged(evt);
        }
    });
    theDcXsiList = dcXsiList;
    theDcXsiList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dcXsiListValueChanged(evt);
        }
    });
    theDcTermsTypeList = dcTermsTypeList;
    theDcTermsTypeList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            dcTermsTypeListValueChanged(evt);
        }
    });
    theDnxDcPane = dnxDcPane;
    theDnxDcPane.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            tabDnxDcStateChanged(evt);
        }
    });
    try {
        loadDNXValues();
    } catch (Exception ex) {
        configuratorFrame.showError("Error loading DNX values", ex.getMessage());
    }
    loadDCValues();
    loadDCXsiValues();
    loadDCTermsValues();
    loadCMSFields();
}

From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfiguratorPresenter.java

private void loadCMSFields() {
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    model.addElement("Id");
    model.addElement("Title");
    model.addElement("Publisher");
    model.addElement("Author");
    model.addElement("Reference");
    model.addElement("Deposit Type");
    model.addElement("Description");
    model.addElement("Coverage");
    model.addElement("Rights");
    model.addElement("Relation");
    theCmsFieldCombo.setModel(model);//from w w w . j  ava2  s.  co  m
}