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:SuitaDetails.java

public void showSuiteLib() {
    JScrollPane jScrollPane1 = new JScrollPane();
    JList jList1 = new JList();
    JPanel libraries = new JPanel();
    jScrollPane1.setViewportView(jList1);
    GroupLayout layout = new GroupLayout(libraries);
    libraries.setLayout(layout);/*from   w w  w. ja v  a 2 s. c  om*/
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1,
            GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE));

    try {
        Object[] s = (Object[]) RunnerRepository.getRPCClient().execute("getLibrariesList",
                new Object[] { RunnerRepository.user });
        String[] libs = new String[s.length];
        for (int i = 0; i < s.length; i++) {
            libs[i] = s[i].toString();
        }
        ArrayList<Integer> ind = new ArrayList<Integer>();
        jList1.setModel(new DefaultComboBoxModel(libs));
        if (parent.getLibs() != null) {
            for (String st : parent.getLibs()) {
                for (int i = 0; i < libs.length; i++) {
                    if (libs[i].equals(st)) {
                        ind.add(new Integer(i));
                    }
                }
            }
            int[] indices = new int[ind.size()];
            for (int i = 0; i < ind.size(); i++) {
                indices[i] = ind.get(i);
            }
            jList1.setSelectedIndices(indices);
        }
    } catch (Exception e) {
        System.out.println("There was an error on calling getLibrariesList on CE");
        e.printStackTrace();
    }
    int resp = (Integer) CustomDialog.showDialog(libraries, JOptionPane.PLAIN_MESSAGE,
            JOptionPane.OK_CANCEL_OPTION, RunnerRepository.window, "Libraries", null);
    if (resp == JOptionPane.OK_OPTION) {
        Object[] val = jList1.getSelectedValues();
        String[] libs = new String[val.length];
        for (int s = 0; s < val.length; s++) {
            libs[s] = val[s].toString();
        }
        parent.setLibs(libs);
    }
}

From source file:com.mycompany.listBoxer.panel.ListBoxerForm.java

private void NumericCheckBoxActionPerformed(ActionEvent evt) {
    try {// ww  w. j a  v  a 2  s. c o m
        jTextField1.setValue(StringUtils.EMPTY);
        factory.setDefaultFormatter(new MaskFormatter("####"));
        jTextField1.setFormatterFactory(factory);
    } catch (ParseException e) {
        e.getMessage();
    }
    RangeComboBox.setModel(
            new DefaultComboBoxModel<String>(new String[] { RangeType.ALL.getKey(), RangeType.NUM1.getKey(),
                    RangeType.NUM2.getKey(), RangeType.NUM3.getKey(), RangeType.NUM4.getKey() }));
}

From source file:com.cch.aj.entryrecorder.frame.SettingsJFrame.java

private void UpdateTabEmbossing(Integer id) {
    int selectedIndex = FillEmbossingComboBox(this.cbEmbossing, id, "");
    if (selectedIndex >= 0) {
        Embossing currentEmbossing = ((ComboBoxItem<Embossing>) this.cbEmbossing.getSelectedItem()).getItem();
        ///*  w ww.  ja v a2s  . c  o  m*/
        this.cbEmbossingType.setSelectedItem(currentEmbossing.getType());
        this.txtEmbossingName.setText(currentEmbossing.getName());
    } else {
        this.cbEmbossing.setModel(new DefaultComboBoxModel(new ComboBoxItem[] {}));
        this.txtEmbossingName.setText("");
    }

    if (this.cbEmbossing.getSelectedItem() == null
            || ((ComboBoxItem<Embossing>) this.cbEmbossing.getSelectedItem()).getId() == 0) {
        this.pnlEditEmbossing.setVisible(false);
        this.btnEmbossingDelete.setVisible(false);
        this.btnEmbossingSave.setVisible(false);
        this.btnEmbossingUndo.setVisible(false);
    } else {
        this.pnlEditEmbossing.setVisible(true);
        this.btnEmbossingDelete.setVisible(true);
        this.btnEmbossingSave.setVisible(true);
        this.btnEmbossingUndo.setVisible(true);
    }

}

From source file:com.mirth.connect.connectors.file.FileReader.java

private void initComponents() {
    schemeLabel = new JLabel();
    schemeLabel.setText("Method:");
    schemeComboBox = new MirthComboBox();
    schemeComboBox.setModel(new DefaultComboBoxModel(new String[] { "file", "ftp", "sftp", "smb", "webdav" }));
    schemeComboBox.setToolTipText(//w w w  . j av  a2 s.co m
            "The basic method used to access files to be read - file (local filesystem), FTP, SFTP, Samba share, or WebDAV");
    schemeComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            schemeComboBoxActionPerformed(evt);
        }
    });

    testConnectionButton = new JButton();
    testConnectionButton.setText("Test Read");
    testConnectionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            testConnectionActionPerformed(evt);
        }
    });

    advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png")));
    advancedSettingsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            advancedFileSettingsActionPerformed();
        }
    });

    summaryLabel = new JLabel("Advanced Options:");
    summaryField = new JLabel("");

    directoryLabel = new JLabel();
    directoryLabel.setText("Directory:");
    directoryField = new MirthTextField();
    directoryField.setToolTipText("The directory (folder) in which the files to be read can be found.");

    hostLabel = new JLabel();
    hostLabel.setText("ftp://");
    hostField = new MirthTextField();
    hostField.setToolTipText(
            "The name or IP address of the host (computer) on which the files to be read can be found.");
    pathLabel = new JLabel();
    pathLabel.setText("/");
    pathField = new MirthTextField();
    pathField.setToolTipText("The directory (folder) in which the files to be read can be found.");

    filenameFilterLabel = new JLabel();
    filenameFilterLabel.setText("Filename Filter Pattern:");
    fileNameFilterField = new MirthTextField();
    fileNameFilterField.setToolTipText(
            "<html>The pattern which names of files must match in order to be read.<br>Files with names that do not match the pattern will be ignored.</html>");
    filenameFilterRegexCheckBox = new MirthCheckBox();
    filenameFilterRegexCheckBox.setBackground(UIConstants.BACKGROUND_COLOR);
    filenameFilterRegexCheckBox.setText("Regular Expression");
    filenameFilterRegexCheckBox.setToolTipText(
            "<html>If Regex is checked, the pattern is treated as a regular expression.<br>If Regex is not checked, it is treated as a pattern that supports wildcards and a comma separated list.</html>");

    directoryRecursionLabel = new JLabel();
    directoryRecursionLabel.setText("Include All Subdirectories:");

    directoryRecursionYesRadio = new MirthRadioButton();
    directoryRecursionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    directoryRecursionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    directoryRecursionYesRadio.setText("Yes");
    directoryRecursionYesRadio.setToolTipText(
            "<html>Select Yes to traverse directories recursively and search for files in each one.</html>");
    directoryRecursionYesRadio.setMargin(new Insets(0, 0, 0, 0));
    directoryRecursionYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            directoryRecursionYesRadioActionPerformed(evt);
        }
    });

    directoryRecursionNoRadio = new MirthRadioButton();
    directoryRecursionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    directoryRecursionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    directoryRecursionNoRadio.setSelected(true);
    directoryRecursionNoRadio.setText("No");
    directoryRecursionNoRadio.setToolTipText(
            "<html>Select No to only search for files in the selected directory/location, ignoring subdirectories.</html>");
    directoryRecursionNoRadio.setMargin(new Insets(0, 0, 0, 0));

    directoryRecursionButtonGroup = new ButtonGroup();
    directoryRecursionButtonGroup.add(directoryRecursionYesRadio);
    directoryRecursionButtonGroup.add(directoryRecursionNoRadio);

    ignoreDotFilesLabel = new JLabel();
    ignoreDotFilesLabel.setText("Ignore . files:");

    ignoreDotFilesYesRadio = new MirthRadioButton();
    ignoreDotFilesYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    ignoreDotFilesYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    ignoreDotFilesYesRadio.setText("Yes");
    ignoreDotFilesYesRadio.setToolTipText("Select Yes to ignore all files starting with a period.");
    ignoreDotFilesYesRadio.setMargin(new Insets(0, 0, 0, 0));

    ignoreDotFilesNoRadio = new MirthRadioButton();
    ignoreDotFilesNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    ignoreDotFilesNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    ignoreDotFilesNoRadio.setText("No");
    ignoreDotFilesNoRadio.setToolTipText("Select No to process files starting with a period.");
    ignoreDotFilesNoRadio.setMargin(new Insets(0, 0, 0, 0));

    ignoreDotFilesButtonGroup = new ButtonGroup();
    ignoreDotFilesButtonGroup.add(ignoreDotFilesYesRadio);
    ignoreDotFilesButtonGroup.add(ignoreDotFilesNoRadio);

    anonymousLabel = new JLabel();
    anonymousLabel.setText("Anonymous:");

    anonymousYesRadio = new MirthRadioButton();
    anonymousYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    anonymousYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    anonymousYesRadio.setText("Yes");
    anonymousYesRadio
            .setToolTipText("Connects to the file anonymously instead of using a username and password.");
    anonymousYesRadio.setMargin(new Insets(0, 0, 0, 0));
    anonymousYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            anonymousYesActionPerformed(evt);
        }
    });

    anonymousNoRadio = new MirthRadioButton();
    anonymousNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    anonymousNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    anonymousNoRadio.setSelected(true);
    anonymousNoRadio.setText("No");
    anonymousNoRadio
            .setToolTipText("Connects to the file using a username and password instead of anonymously.");
    anonymousNoRadio.setMargin(new Insets(0, 0, 0, 0));
    anonymousNoRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            anonymousNoActionPerformed(evt);
        }
    });

    anonymousButtonGroup = new ButtonGroup();
    anonymousButtonGroup.add(anonymousYesRadio);
    anonymousButtonGroup.add(anonymousNoRadio);

    usernameLabel = new JLabel();
    usernameLabel.setText("Username:");
    usernameField = new MirthTextField();
    usernameField.setToolTipText("The user name used to gain access to the server.");

    passwordLabel = new JLabel();
    passwordLabel.setText("Password:");
    passwordField = new MirthPasswordField();
    passwordField.setToolTipText("The password used to gain access to the server.");

    timeoutLabel = new JLabel();
    timeoutLabel.setText("Timeout (ms):");
    timeoutField = new MirthTextField();
    timeoutField.setToolTipText("The socket timeout (in ms) for connecting to the server.");

    secureModeLabel = new JLabel();
    secureModeLabel.setText("Secure Mode:");

    secureModeYesRadio = new MirthRadioButton();
    secureModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    secureModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    secureModeYesRadio.setText("Yes");
    secureModeYesRadio.setToolTipText(
            "<html>Select Yes to connect to the server via HTTPS.<br>Select No to connect via HTTP.</html>");
    secureModeYesRadio.setMargin(new Insets(0, 0, 0, 0));
    secureModeYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            secureModeYesActionPerformed(evt);
        }
    });

    secureModeNoRadio = new MirthRadioButton();
    secureModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    secureModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    secureModeNoRadio.setSelected(true);
    secureModeNoRadio.setText("No");
    secureModeNoRadio.setToolTipText(
            "<html>Select Yes to connect to the server via HTTPS.<br>Select No to connect via HTTP.</html>");
    secureModeNoRadio.setMargin(new Insets(0, 0, 0, 0));
    secureModeNoRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            secureModeNoActionPerformed(evt);
        }
    });

    secureModeButtonGroup = new ButtonGroup();
    secureModeButtonGroup.add(secureModeYesRadio);
    secureModeButtonGroup.add(secureModeNoRadio);

    passiveModeLabel = new JLabel();
    passiveModeLabel.setText("Passive Mode:");

    passiveModeYesRadio = new MirthRadioButton();
    passiveModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    passiveModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    passiveModeYesRadio.setText("Yes");
    passiveModeYesRadio.setToolTipText(
            "<html>Select Yes to connect to the server in \"passive mode\".<br>Passive mode sometimes allows a connection through a firewall that normal mode does not.</html>");
    passiveModeYesRadio.setMargin(new Insets(0, 0, 0, 0));

    passiveModeNoRadio = new MirthRadioButton();
    passiveModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    passiveModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    passiveModeNoRadio.setSelected(true);
    passiveModeNoRadio.setText("No");
    passiveModeNoRadio.setToolTipText(
            "Select Yes to connect to the server in \"normal mode\" as opposed to passive mode.");
    passiveModeNoRadio.setMargin(new Insets(0, 0, 0, 0));

    passiveModeButtonGroup = new ButtonGroup();
    passiveModeButtonGroup.add(passiveModeYesRadio);
    passiveModeButtonGroup.add(passiveModeNoRadio);

    validateConnectionLabel = new JLabel();
    validateConnectionLabel.setText("Validate Connection:");

    validateConnectionYesRadio = new MirthRadioButton();
    validateConnectionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    validateConnectionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    validateConnectionYesRadio.setText("Yes");
    validateConnectionYesRadio
            .setToolTipText("Select Yes to test the connection to the server before each operation.");
    validateConnectionYesRadio.setMargin(new Insets(0, 0, 0, 0));

    validateConnectionNoRadio = new MirthRadioButton();
    validateConnectionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    validateConnectionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    validateConnectionNoRadio.setText("No");
    validateConnectionNoRadio
            .setToolTipText("Select No to skip testing the connection to the server before each operation.");
    validateConnectionNoRadio.setMargin(new Insets(0, 0, 0, 0));

    validateConnectionButtonGroup = new ButtonGroup();
    validateConnectionButtonGroup.add(validateConnectionYesRadio);
    validateConnectionButtonGroup.add(validateConnectionNoRadio);

    afterProcessingActionLabel = new JLabel();
    afterProcessingActionLabel.setText("After Processing Action:");

    afterProcessingActionComboBox = new MirthComboBox();
    afterProcessingActionComboBox.setModel(new DefaultComboBoxModel(new String[] { "None", "Move", "Delete" }));
    afterProcessingActionComboBox.setToolTipText(
            "<html>Select Move to move and/or rename the file after successful processing.<br/>Select Delete to delete the file after successful processing.</html>");
    afterProcessingActionComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            afterProcessingActionComboBoxActionPerformed(evt);
        }
    });

    moveToDirectoryLabel = new JLabel();
    moveToDirectoryLabel.setText("Move-to Directory:");
    moveToDirectoryField = new MirthTextField();
    moveToDirectoryField.setToolTipText(
            "<html>If successfully processed files should be moved to a different directory (folder), enter that directory here.<br>The directory name specified may include template substitutions from the list to the right.<br>If this field is left empty, successfully processed files will not be moved to a different directory.</html>");

    moveToFileNameLabel = new JLabel();
    moveToFileNameLabel.setText("Move-to File Name:");
    moveToFileNameField = new MirthTextField();
    moveToFileNameField.setToolTipText(
            "<html>If successfully processed files should be renamed, enter the new name here.<br>The filename specified may include template substitutions from the list to the right.<br>If this field is left empty, successfully processed files will not be renamed.</html>");

    errorReadingActionLabel = new JLabel();
    errorReadingActionLabel.setText("Error Reading Action:");

    errorReadingActionComboBox = new MirthComboBox();
    errorReadingActionComboBox.setModel(new DefaultComboBoxModel(new String[] { "None", "Move", "Delete" }));
    errorReadingActionComboBox.setToolTipText(
            "<html>Select Move to move and/or rename files that have failed to be read in.<br/>Select Delete to delete files that have failed to be read in.</html>");
    errorReadingActionComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            errorReadingActionComboBoxActionPerformed(evt);
        }
    });

    errorResponseActionLabel = new JLabel();
    errorResponseActionLabel.setText("Error in Response Action:");

    errorResponseActionComboBox = new MirthComboBox();
    errorResponseActionComboBox
            .setModel(new DefaultComboBoxModel(new String[] { "After Processing Action", "Move", "Delete" }));
    errorResponseActionComboBox.setToolTipText(
            "<html>Select Move to move and/or rename the file if an ERROR response is returned.<br/>Select Delete to delete the file if an ERROR response is returned.<br/>If After Processing Action is selected, the After Processing Action will apply.<br/>This action is only available if Process Batch Files is disabled.</html>");
    errorResponseActionComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            errorResponseActionComboBoxActionPerformed(evt);
        }
    });

    errorMoveToDirectoryLabel = new JLabel();
    errorMoveToDirectoryLabel.setText("Error Move-to Directory:");
    errorMoveToDirectoryField = new MirthTextField();
    errorMoveToDirectoryField.setToolTipText(
            "<html>If files which cause processing errors should be moved to a different directory (folder), enter that directory here.<br>The directory name specified may include template substitutions from the list to the right.<br>If this field is left empty, files which cause processing errors will not be moved to a different directory.</html>");

    errorMoveToFileNameLabel = new JLabel();
    errorMoveToFileNameLabel.setText("Error Move-to File Name:");
    errorMoveToFileNameField = new MirthTextField();
    errorMoveToFileNameField.setToolTipText(
            "<html>If files which cause processing errors should be renamed, enter the new name here.<br/>The filename specified may include template substitutions from the list to the right.<br/>If this field is left empty, files which cause processing errors will not be renamed.</html>");

    variableListScrollPane = new JScrollPane();
    variableListScrollPane.setBorder(null);
    variableListScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    variableListScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

    mirthVariableList = new MirthVariableList();
    mirthVariableList.setBorder(BorderFactory.createEtchedBorder());
    mirthVariableList.setModel(new AbstractListModel() {
        String[] strings = { "channelName", "channelId", "DATE", "COUNT", "UUID", "SYSTIME",
                "originalFilename" };

        public int getSize() {
            return strings.length;
        }

        public Object getElementAt(int i) {
            return strings[i];
        }
    });
    variableListScrollPane.setViewportView(mirthVariableList);

    checkFileAgeLabel = new JLabel();
    checkFileAgeLabel.setText("Check File Age:");

    checkFileAgeYesRadio = new MirthRadioButton();
    checkFileAgeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    checkFileAgeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    checkFileAgeYesRadio.setText("Yes");
    checkFileAgeYesRadio
            .setToolTipText("Select Yes to skip files that are created within the specified age below.");
    checkFileAgeYesRadio.setMargin(new Insets(0, 0, 0, 0));
    checkFileAgeYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            checkFileAgeYesActionPerformed(evt);
        }
    });

    checkFileAgeNoRadio = new MirthRadioButton();
    checkFileAgeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR);
    checkFileAgeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    checkFileAgeNoRadio.setSelected(true);
    checkFileAgeNoRadio.setText("No");
    checkFileAgeNoRadio.setToolTipText("Select No to process files regardless of age.");
    checkFileAgeNoRadio.setMargin(new Insets(0, 0, 0, 0));
    checkFileAgeNoRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            checkFileAgeNoActionPerformed(evt);
        }
    });

    checkFileAgeButtonGroup = new ButtonGroup();
    checkFileAgeButtonGroup.add(checkFileAgeYesRadio);
    checkFileAgeButtonGroup.add(checkFileAgeNoRadio);

    fileAgeLabel = new JLabel();
    fileAgeLabel.setText("File Age (ms):");
    fileAgeField = new MirthTextField();
    fileAgeField.setToolTipText(
            "If Check File Age Yes is selected, only the files created that are older than the specified value in milliseconds will be processed.");

    fileSizeLabel = new JLabel();
    fileSizeLabel.setText("File Size (bytes):");
    fileSizeMinimumField = new MirthTextField();
    fileSizeMinimumField.setToolTipText("<html>The minimum size (in bytes) of files to be accepted.</html>");
    fileSizeDashLabel = new JLabel();
    fileSizeDashLabel.setText("-");
    fileSizeMaximumField = new MirthTextField();
    fileSizeMaximumField.setToolTipText(
            "<html>The maximum size (in bytes) of files to be accepted.<br/>This option has no effect if Ignore Maximum is checked.</html>");
    ignoreFileSizeMaximumCheckBox = new MirthCheckBox();
    ignoreFileSizeMaximumCheckBox.setBackground(UIConstants.BACKGROUND_COLOR);
    ignoreFileSizeMaximumCheckBox.setText("Ignore Maximum");
    ignoreFileSizeMaximumCheckBox.setToolTipText(
            "<html>If checked, only the minimum file size will be checked against incoming files.</html>");
    ignoreFileSizeMaximumCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            ignoreFileSizeMaximumCheckBoxActionPerformed(evt);
        }
    });

    sortFilesByLabel = new JLabel();
    sortFilesByLabel.setText("Sort Files By:");
    sortByComboBox = new MirthComboBox();
    sortByComboBox.setModel(new DefaultComboBoxModel(new String[] { "Date", "Name", "Size" }));
    sortByComboBox.setToolTipText(
            "<html>Selects the order in which files should be processed, if there are multiple files available to be processed.<br>Files can be processed by Date (oldest last modification date first), Size (smallest first) or name (a before z, etc.).</html>");

    fileTypeLabel = new JLabel();
    fileTypeLabel.setText("File Type:");

    fileTypeBinary = new MirthRadioButton();
    fileTypeBinary.setBackground(UIConstants.BACKGROUND_COLOR);
    fileTypeBinary.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    fileTypeBinary.setText("Binary");
    fileTypeBinary.setToolTipText(
            "<html>Select Binary if files contain binary data; the contents will be Base64 encoded before processing.<br>Select Text if files contain text data; the contents will be encoded using the specified character set encoding.</html>");
    fileTypeBinary.setMargin(new Insets(0, 0, 0, 0));
    fileTypeBinary.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            fileTypeBinaryActionPerformed(evt);
        }
    });

    fileTypeText = new MirthRadioButton();
    fileTypeText.setBackground(UIConstants.BACKGROUND_COLOR);
    fileTypeText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    fileTypeText.setSelected(true);
    fileTypeText.setText("Text");
    fileTypeText.setToolTipText(
            "<html>Select Binary if files contain binary data; the contents will be Base64 encoded before processing.<br>Select Text if files contain text data; the contents will be encoded using the specified character set encoding.</html>");
    fileTypeText.setMargin(new Insets(0, 0, 0, 0));
    fileTypeText.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            fileTypeASCIIActionPerformed(evt);
        }
    });

    fileTypeButtonGroup = new ButtonGroup();
    fileTypeButtonGroup.add(fileTypeBinary);
    fileTypeButtonGroup.add(fileTypeText);

    encodingLabel = new JLabel();
    encodingLabel.setText("Encoding:");

    charsetEncodingComboBox = new MirthComboBox();
    charsetEncodingComboBox.setModel(new DefaultComboBoxModel(new String[] { "Default", "UTF-8", "ISO-8859-1",
            "UTF-16 (le)", "UTF-16 (be)", "UTF-16 (bom)", "US-ASCII" }));
    charsetEncodingComboBox.setToolTipText(
            "If File Type Text is selected, select the character set encoding (ASCII, UTF-8, etc.) to be used in reading the contents of each file.");
}

From source file:com.mirth.connect.client.ui.panels.connectors.ResponseSettingsPanel.java

private void sourceQueueComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sourceQueueComboBoxActionPerformed
    Object selectedItem = responseComboBox.getSelectedItem();

    if (sourceQueueComboBox.getSelectedIndex() == 0) {
        responseComboBox.setModel(new DefaultComboBoxModel(queueOffRespondFromNames.toArray()));
    } else {// w w  w.  j  ava  2  s.c  om
        responseComboBox.setModel(new DefaultComboBoxModel(queueOnRespondFromNames.toArray()));
    }

    setSelectedItem(selectedItem);

    channelSetup.saveSourcePanel();
    MessageStorageMode messageStorageMode = channelSetup.getMessageStorageMode();
    channelSetup.updateQueueWarning(messageStorageMode);
    updateQueueWarning(messageStorageMode);
}

From source file:com.mirth.connect.plugins.httpauth.HttpAuthConnectorPropertiesPanel.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);

    typeLabel = new JLabel("Authentication Type:");
    typeLabel.setHorizontalAlignment(SwingConstants.RIGHT);

    typeComboBox = new MirthComboBox();
    typeComboBox.setModel(new DefaultComboBoxModel<AuthType>(AuthType.values()));
    typeComboBox.addActionListener(new ActionListener() {
        @Override//www .  j av  a  2  s. c  om
        public void actionPerformed(ActionEvent evt) {
            authTypeChanged();
        }
    });
    typeComboBox.setToolTipText("Select the type of HTTP authentication to perform for incoming requests.");

    basicRealmLabel = new JLabel("Realm:");
    basicRealmField = new MirthTextField();
    basicRealmField.setToolTipText("The protection space for this server.");
    basicCredentialsLabel = new JLabel("Credentials:");

    basicCredentialsPanel = new JPanel();
    basicCredentialsPanel.setBackground(getBackground());

    basicCredentialsTable = new MirthTable();
    basicCredentialsTable.setModel(new RefreshTableModel(new String[] { "Username", "Password" }, 0));
    basicCredentialsTable.setCustomEditorControls(true);
    basicCredentialsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    basicCredentialsTable.setRowSelectionAllowed(true);
    basicCredentialsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    basicCredentialsTable.setDragEnabled(false);
    basicCredentialsTable.setOpaque(true);
    basicCredentialsTable.setSortable(false);
    basicCredentialsTable.getTableHeader().setReorderingAllowed(false);
    basicCredentialsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    basicCredentialsTable.setToolTipText(
            "<html>Username and password pairs to authenticate<br/>users with. At least one pair is required.</html>");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        basicCredentialsTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor basicCredentialsTableCellEditor = new CredentialsTableCellEditor(
            basicCredentialsTable);
    basicCredentialsTable.getColumnExt(0).setCellEditor(basicCredentialsTableCellEditor);
    basicCredentialsTable.getColumnExt(0).setToolTipText("The username to authenticate with.");
    basicCredentialsTable.getColumnExt(1).setCellRenderer(new PasswordCellRenderer());
    basicCredentialsTable.getColumnExt(1).setCellEditor(new DefaultCellEditor(new JPasswordField()));
    basicCredentialsTable.getColumnExt(1).setToolTipText("The password to authenticate with.");

    basicCredentialsTableScrollPane = new JScrollPane(basicCredentialsTable);

    basicCredentialsNewButton = new MirthButton("New");
    basicCredentialsNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String username;
            boolean found;
            do {
                num++;
                username = "user" + num;

                found = false;
                for (int row = 0; row < basicCredentialsTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(username,
                            (String) basicCredentialsTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) basicCredentialsTable.getModel()).addRow(new String[] { username, "" });
            basicCredentialsTable.setRowSelectionInterval(basicCredentialsTable.getRowCount() - 1,
                    basicCredentialsTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    basicCredentialsDeleteButton = new MirthButton("Delete");
    basicCredentialsDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(basicCredentialsTable);
            if (selectedRow >= 0) {
                if (basicCredentialsTable.isEditing()) {
                    basicCredentialsTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) basicCredentialsTable.getModel()).removeRow(selectedRow);

                int rowCount = basicCredentialsTable.getRowCount();
                if (selectedRow < rowCount) {
                    basicCredentialsTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    basicCredentialsTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    basicCredentialsTableCellEditor.setDeleteButton(basicCredentialsDeleteButton);

    digestRealmLabel = new JLabel("Realm:");
    digestRealmField = new MirthTextField();
    digestRealmField.setToolTipText("The protection space for this server.");

    digestAlgorithmLabel = new JLabel("Algorithms:");
    ButtonGroup digestAlgorithmButtonGroup = new ButtonGroup();
    String toolTipText = "<html>Specifies the digest algorithms supported by this server.<br/><b>&nbsp;- MD5:</b> The security data A1 will contain the username, realm, and password.<br/><b>&nbsp;- MD5-sess:</b> The security data A1 will also contain the server and client nonces.</html>";

    digestAlgorithmMD5Radio = new MirthRadioButton(Algorithm.MD5.toString());
    digestAlgorithmMD5Radio.setBackground(getBackground());
    digestAlgorithmMD5Radio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmMD5Radio);

    digestAlgorithmMD5SessRadio = new MirthRadioButton(Algorithm.MD5_SESS.toString());
    digestAlgorithmMD5SessRadio.setBackground(getBackground());
    digestAlgorithmMD5SessRadio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmMD5SessRadio);

    digestAlgorithmBothRadio = new MirthRadioButton("Both");
    digestAlgorithmBothRadio.setBackground(getBackground());
    digestAlgorithmBothRadio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmBothRadio);

    digestQOPLabel = new JLabel("QOP Modes:");
    toolTipText = "<html>The quality of protection modes to support.<br/><b>&nbsp;- auth:</b> Regular auth with client nonce and count in the digest.<br/><b>&nbsp;- auth-int:</b> Same as auth, but also with message integrity protection enabled.</html>";

    digestQOPAuthCheckBox = new MirthCheckBox(QOPMode.AUTH.toString());
    digestQOPAuthCheckBox.setBackground(getBackground());
    digestQOPAuthCheckBox.setToolTipText(toolTipText);

    digestQOPAuthIntCheckBox = new MirthCheckBox(QOPMode.AUTH_INT.toString());
    digestQOPAuthIntCheckBox.setBackground(getBackground());
    digestQOPAuthIntCheckBox.setToolTipText(toolTipText);

    digestOpaqueLabel = new JLabel("Opaque:");
    digestOpaqueField = new MirthTextField();
    digestOpaqueField.setToolTipText("A string of data that should be returned by the client unchanged.");
    digestCredentialsLabel = new JLabel("Credentials:");

    digestCredentialsPanel = new JPanel();
    digestCredentialsPanel.setBackground(getBackground());

    digestCredentialsTable = new MirthTable();
    digestCredentialsTable.setModel(new RefreshTableModel(new String[] { "Username", "Password" }, 0));
    digestCredentialsTable.setCustomEditorControls(true);
    digestCredentialsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    digestCredentialsTable.setRowSelectionAllowed(true);
    digestCredentialsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    digestCredentialsTable.setDragEnabled(false);
    digestCredentialsTable.setOpaque(true);
    digestCredentialsTable.setSortable(false);
    digestCredentialsTable.getTableHeader().setReorderingAllowed(false);
    digestCredentialsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    digestCredentialsTable.setToolTipText(
            "<html>Username and password pairs to authenticate<br/>users with. At least one pair is required.</html>");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        digestCredentialsTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor digestCredentialsTableCellEditor = new CredentialsTableCellEditor(
            digestCredentialsTable);
    digestCredentialsTable.getColumnExt(0).setCellEditor(digestCredentialsTableCellEditor);
    digestCredentialsTable.getColumnExt(0).setToolTipText("The username to authenticate with.");
    digestCredentialsTable.getColumnExt(1).setCellRenderer(new PasswordCellRenderer());
    digestCredentialsTable.getColumnExt(1).setCellEditor(new DefaultCellEditor(new JPasswordField()));
    digestCredentialsTable.getColumnExt(1).setToolTipText("The password to authenticate with.");

    digestCredentialsTableScrollPane = new JScrollPane(digestCredentialsTable);

    digestCredentialsNewButton = new MirthButton("New");
    digestCredentialsNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String username;
            boolean found;
            do {
                num++;
                username = "user" + num;

                found = false;
                for (int row = 0; row < digestCredentialsTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(username,
                            (String) digestCredentialsTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) digestCredentialsTable.getModel()).addRow(new String[] { username, "" });
            digestCredentialsTable.setRowSelectionInterval(digestCredentialsTable.getRowCount() - 1,
                    digestCredentialsTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    digestCredentialsDeleteButton = new MirthButton("Delete");
    digestCredentialsDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(digestCredentialsTable);
            if (selectedRow >= 0) {
                if (digestCredentialsTable.isEditing()) {
                    digestCredentialsTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) digestCredentialsTable.getModel()).removeRow(selectedRow);

                int rowCount = digestCredentialsTable.getRowCount();
                if (selectedRow < rowCount) {
                    digestCredentialsTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    digestCredentialsTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    digestCredentialsTableCellEditor.setDeleteButton(digestCredentialsDeleteButton);

    jsScriptLabel = new JLabel("Script:");
    jsScriptField = new JTextField();
    jsScriptField.setEditable(false);
    jsScriptField.setBackground(getBackground());
    jsScriptField.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    jsScriptField.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            JavaScriptHttpAuthDialog dialog = new JavaScriptHttpAuthDialog(PlatformUI.MIRTH_FRAME, jsScript);
            if (dialog.wasSaved()) {
                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
                jsScript = dialog.getScript();
                updateJSScriptField();
            }
        }
    });
    jsScriptField.setToolTipText(
            "<html>Click here to open the JavaScript editor dialog.<br/>The return value of this script is used to accept or reject requests.</html>");

    customClassNameLabel = new JLabel("Class Name:");
    customClassNameField = new MirthTextField();
    customClassNameField
            .setToolTipText("The fully-qualified Java class name of the Authenticator class to use.");
    customPropertiesLabel = new JLabel("Properties:");

    customPropertiesPanel = new JPanel();
    customPropertiesPanel.setBackground(getBackground());

    customPropertiesTable = new MirthTable();
    customPropertiesTable.setModel(new RefreshTableModel(new String[] { "Name", "Value" }, 0));
    customPropertiesTable.setCustomEditorControls(true);
    customPropertiesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    customPropertiesTable.setRowSelectionAllowed(true);
    customPropertiesTable.setRowHeight(UIConstants.ROW_HEIGHT);
    customPropertiesTable.setDragEnabled(false);
    customPropertiesTable.setOpaque(true);
    customPropertiesTable.setSortable(false);
    customPropertiesTable.getTableHeader().setReorderingAllowed(false);
    customPropertiesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    customPropertiesTable.setToolTipText(
            "Optional properties to pass into the Authenticator class when it is instantiated.");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        customPropertiesTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor customPropertiesTableCellEditor = new CredentialsTableCellEditor(
            customPropertiesTable);
    customPropertiesTable.getColumnExt(0).setCellEditor(customPropertiesTableCellEditor);
    customPropertiesTable.getColumnExt(0).setToolTipText("The name of the property to include.");
    customPropertiesTable.getColumnExt(1).setToolTipText("The value of the property to include.");

    customPropertiesTableScrollPane = new JScrollPane(customPropertiesTable);

    customPropertiesNewButton = new MirthButton("New");
    customPropertiesNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String name;
            boolean found;
            do {
                num++;
                name = "Property " + num;

                found = false;
                for (int row = 0; row < customPropertiesTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(name,
                            (String) customPropertiesTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) customPropertiesTable.getModel()).addRow(new String[] { name, "" });
            customPropertiesTable.setRowSelectionInterval(customPropertiesTable.getRowCount() - 1,
                    customPropertiesTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    customPropertiesDeleteButton = new MirthButton("Delete");
    customPropertiesDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(customPropertiesTable);
            if (selectedRow >= 0) {
                if (customPropertiesTable.isEditing()) {
                    customPropertiesTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) customPropertiesTable.getModel()).removeRow(selectedRow);

                int rowCount = customPropertiesTable.getRowCount();
                if (selectedRow < rowCount) {
                    customPropertiesTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    customPropertiesTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    customPropertiesTableCellEditor.setDeleteButton(customPropertiesDeleteButton);

    oauth2TokenLabel = new JLabel("Access Token Location:");

    oauth2TokenLocationComboBox = new MirthComboBox();
    oauth2TokenLocationComboBox.setModel(new DefaultComboBoxModel<TokenLocation>(TokenLocation.values()));
    oauth2TokenLocationComboBox
            .setToolTipText("Determines where the access token is located in client requests.");

    oauth2TokenField = new MirthTextField();
    oauth2TokenField
            .setToolTipText("The header or query parameter to pass along with the verification request.");

    oauth2VerificationURLLabel = new JLabel("Verification URL:");
    oauth2VerificationURLField = new MirthTextField();
    oauth2VerificationURLField.setToolTipText(
            "<html>The HTTP URL to perform a GET request to for access<br/>token verification. If the response code is >= 400,<br/>the authentication attempt is rejected by the server.</html>");

    for (ConnectorPropertiesPlugin connectorPropertiesPlugin : LoadedExtensions.getInstance()
            .getConnectorPropertiesPlugins().values()) {
        if (connectorPropertiesPlugin
                .isConnectorPropertiesPluginSupported(HttpAuthConnectorPluginProperties.PLUGIN_POINT)) {
            connectorPropertiesPanel = connectorPropertiesPlugin.getConnectorPropertiesPanel();
        }
    }
}

From source file:de.codesourcery.eve.skills.ui.components.impl.OreChartComponent.java

@Override
protected JPanel createPanel() {
    final JPanel result = new JPanel();

    table.setFillsViewportHeight(true);//from  ww  w .jav  a 2s.  c  o m
    table.setModel(this.tableModel);
    table.setRowSorter(tableModel.getRowSorter());
    table.setDefaultRenderer(String.class, tableRenderer);
    table.setDefaultRenderer(ISKAmount.class, tableRenderer);
    table.setDefaultRenderer(Integer.class, tableRenderer);

    final PopupMenuBuilder builder = new PopupMenuBuilder();
    builder.addItem("Save summary to clipboard", new Runnable() {

        @Override
        public void run() {
            saveSummaryToClipboard();
        }
    });

    builder.attach(table);

    mineralPriceTable.setFillsViewportHeight(true);

    final ImprovedSplitPane splitPane = new ImprovedSplitPane(JSplitPane.VERTICAL_SPLIT,
            new JScrollPane(mineralPriceTable), new JScrollPane(table));

    splitPane.setDividerLocation(0.3);

    // setup ore hold panel
    final JPanel oreHoldPanel = new JPanel();
    oreHoldPanel.setLayout(new GridBagLayout());

    oreHoldSize.setColumns(10);

    new GridLayoutBuilder().add(new HorizontalGroup(
            new VerticalGroup(
                    new HorizontalGroup(new Cell("ohLabel", new JLabel("Ore hold size (m3):")),
                            new Cell("ohSize", oreHoldSize)),
                    new HorizontalGroup(new Cell("oreTypeLabel", new JLabel("Ore type:")),
                            new Cell("oreChooser", oreChooser)),
                    new HorizontalGroup(new Cell("oreVariantLabel", new JLabel("Ore variant:")),
                            new Cell("oreVariantChooser", oreVariantChooser))),
            new Cell("oreHoldValue", oreHoldValue.getPanel()))).enableDebugMode().addTo(oreHoldPanel);

    final List<String> oreNames = refiningData.getOreNames(OreVariant.BASIC);
    Collections.sort(oreNames);

    oreChooser.setModel(new DefaultComboBoxModel<>(new Vector<String>(oreNames)));
    oreChooser.setSelectedItem(oreNames.get(0));

    oreVariantChooser.setModel(new DefaultComboBoxModel<>(OreVariant.values()));
    oreVariantChooser.setSelectedItem(OreVariant.BASIC);

    final ActionListener refreshListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            refresh();
        }
    };

    oreHoldSize.addActionListener(refreshListener);
    oreChooser.addActionListener(refreshListener);
    oreVariantChooser.addActionListener(refreshListener);

    new GridLayoutBuilder().add(new VerticalGroup(new Cell(oreHoldPanel).noResize(), new Cell(splitPane)))
            .addTo(result);

    refresh();

    return result;
}

From source file:com.mycompany.listBoxer.panel.ListBoxerForm.java

private void CombinedCheckBoxActionPerformed(ActionEvent evt) {
    try {/*from  w  ww.ja v  a  2  s  .  c o m*/
        jTextField1.setValue(StringUtils.EMPTY);
        factory.setDefaultFormatter(new MaskFormatter("****"));
        jTextField1.setFormatterFactory(factory);
    } catch (ParseException e) {
        e.getMessage();
    }
    RangeComboBox.setModel(new DefaultComboBoxModel<String>(new String[] { RangeType.ALL.getKey(),
            RangeType.AM.getKey(), RangeType.NZ.getKey(), RangeType.NUM1.getKey(), RangeType.NUM2.getKey(),
            RangeType.NUM3.getKey(), RangeType.NUM4.getKey() }));
}

From source file:com.microsoft.intellij.forms.CreateWebSiteForm.java

private void fillSubscriptions() {
    //        try {
    List<Subscription> subscriptionList = AzureManagerImpl.getManager(project).getSubscriptionList();
    DefaultComboBoxModel subscriptionComboModel = new DefaultComboBoxModel(subscriptionList.toArray());
    subscriptionComboModel.setSelectedItem(null);
    subscriptionComboBox.setModel(subscriptionComboModel);
    if (!subscriptionList.isEmpty()) {
        subscriptionComboBox.setSelectedIndex(0);
    }/*  ww w  .j  a va2s  . c o  m*/
    //        } catch (AzureCmdException e) {
    //            String msg = "An error occurred while trying to load the subscriptions list." + "\n" + String.format(message("webappExpMsg"), e.getMessage());
    //            PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, e);
    //        }
}

From source file:com.cch.aj.entryrecorder.frame.SettingsJFrame.java

private void UpdateTabStaff(int id) {
    int selectedIndex = FillStaffComboBox(this.cbStaff, id, "");
    if (selectedIndex >= 0) {
        Staff currentStaff = ((ComboBoxItem<Staff>) this.cbStaff.getSelectedItem()).getItem();
        ///*  w ww .  j  a  va2  s  .  c o m*/
        this.cbStaffJob.setSelectedItem(currentStaff.getJobType());
        this.txtStaffName.setText(currentStaff.getName());
    } else {
        this.cbStaff.setModel(new DefaultComboBoxModel(new ComboBoxItem[] {}));
        this.txtStaffName.setText("");
    }

    if (this.cbStaff.getSelectedItem() == null
            || ((ComboBoxItem<Staff>) this.cbStaff.getSelectedItem()).getId() == 0) {
        this.pnlEditStaff.setVisible(false);
        this.btnStaffDelete.setVisible(false);
        this.btnStaffSave.setVisible(false);
        this.btnStaffUndo.setVisible(false);
    } else {
        this.pnlEditStaff.setVisible(true);
        this.btnStaffDelete.setVisible(true);
        this.btnStaffSave.setVisible(true);
        this.btnStaffUndo.setVisible(true);
    }
}