Example usage for javax.swing JList getSelectedValues

List of usage examples for javax.swing JList getSelectedValues

Introduction

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

Prototype

@Deprecated
@BeanProperty(bound = false)
public Object[] getSelectedValues() 

Source Link

Document

Returns an array of all the selected values, in increasing order based on their indices in the list.

Usage

From source file:BasicDnD.java

public BasicDnD() {
    super(new BorderLayout());
    JPanel leftPanel = createVerticalBoxPanel();
    JPanel rightPanel = createVerticalBoxPanel();

    // Create a table model.
    DefaultTableModel tm = new DefaultTableModel();
    tm.addColumn("Column 0");
    tm.addColumn("Column 1");
    tm.addColumn("Column 2");
    tm.addColumn("Column 3");
    tm.addRow(new String[] { "Table 00", "Table 01", "Table 02", "Table 03" });
    tm.addRow(new String[] { "Table 10", "Table 11", "Table 12", "Table 13" });
    tm.addRow(new String[] { "Table 20", "Table 21", "Table 22", "Table 23" });
    tm.addRow(new String[] { "Table 30", "Table 31", "Table 32", "Table 33" });

    // LEFT COLUMN
    // Use the table model to create a table.
    table = new JTable(tm);
    leftPanel.add(createPanelForComponent(table, "JTable"));

    // Create a color chooser.
    colorChooser = new JColorChooser();
    leftPanel.add(createPanelForComponent(colorChooser, "JColorChooser"));

    // RIGHT COLUMN
    // Create a textfield.
    textField = new JTextField(30);
    textField.setText("Favorite foods:\nPizza, Moussaka, Pot roast");
    rightPanel.add(createPanelForComponent(textField, "JTextField"));

    // Create a scrolled text area.
    textArea = new JTextArea(5, 30);
    textArea.setText("Favorite shows:\nBuffy, Alias, Angel");
    JScrollPane scrollPane = new JScrollPane(textArea);
    rightPanel.add(createPanelForComponent(scrollPane, "JTextArea"));

    // Create a list model and a list.
    DefaultListModel listModel = new DefaultListModel();
    listModel.addElement("Martha Washington");
    listModel.addElement("Abigail Adams");
    listModel.addElement("Martha Randolph");
    listModel.addElement("Dolley Madison");
    listModel.addElement("Elizabeth Monroe");
    listModel.addElement("Louisa Adams");
    listModel.addElement("Emily Donelson");
    list = new JList(listModel);
    list.setVisibleRowCount(-1);/* w  w w  . j ava2  s.  c o  m*/
    list.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    list.setTransferHandler(new TransferHandler() {

        public boolean canImport(TransferHandler.TransferSupport info) {
            // we only import Strings
            if (!info.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                return false;
            }

            JList.DropLocation dl = (JList.DropLocation) info.getDropLocation();
            if (dl.getIndex() == -1) {
                return false;
            }
            return true;
        }

        public boolean importData(TransferHandler.TransferSupport info) {
            if (!info.isDrop()) {
                return false;
            }

            // Check for String flavor
            if (!info.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                displayDropLocation("List doesn't accept a drop of this type.");
                return false;
            }

            JList.DropLocation dl = (JList.DropLocation) info.getDropLocation();
            DefaultListModel listModel = (DefaultListModel) list.getModel();
            int index = dl.getIndex();
            boolean insert = dl.isInsert();
            // Get the current string under the drop.
            String value = (String) listModel.getElementAt(index);

            // Get the string that is being dropped.
            Transferable t = info.getTransferable();
            String data;
            try {
                data = (String) t.getTransferData(DataFlavor.stringFlavor);
            } catch (Exception e) {
                return false;
            }

            // Display a dialog with the drop information.
            String dropValue = "\"" + data + "\" dropped ";
            if (dl.isInsert()) {
                if (dl.getIndex() == 0) {
                    displayDropLocation(dropValue + "at beginning of list");
                } else if (dl.getIndex() >= list.getModel().getSize()) {
                    displayDropLocation(dropValue + "at end of list");
                } else {
                    String value1 = (String) list.getModel().getElementAt(dl.getIndex() - 1);
                    String value2 = (String) list.getModel().getElementAt(dl.getIndex());
                    displayDropLocation(dropValue + "between \"" + value1 + "\" and \"" + value2 + "\"");
                }
            } else {
                displayDropLocation(dropValue + "on top of " + "\"" + value + "\"");
            }

            /**
             * This is commented out for the basicdemo.html tutorial page. * If you
             * add this code snippet back and delete the * "return false;" line, the
             * list will accept drops * of type string. // Perform the actual
             * import. if (insert) { listModel.add(index, data); } else {
             * listModel.set(index, data); } return true;
             */
            return false;
        }

        public int getSourceActions(JComponent c) {
            return COPY;
        }

        protected Transferable createTransferable(JComponent c) {
            JList list = (JList) c;
            Object[] values = list.getSelectedValues();

            StringBuffer buff = new StringBuffer();

            for (int i = 0; i < values.length; i++) {
                Object val = values[i];
                buff.append(val == null ? "" : val.toString());
                if (i != values.length - 1) {
                    buff.append("\n");
                }
            }
            return new StringSelection(buff.toString());
        }
    });
    list.setDropMode(DropMode.ON_OR_INSERT);

    JScrollPane listView = new JScrollPane(list);
    listView.setPreferredSize(new Dimension(300, 100));
    rightPanel.add(createPanelForComponent(listView, "JList"));

    // Create a tree.
    DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Mia Familia");
    DefaultMutableTreeNode sharon = new DefaultMutableTreeNode("Sharon");
    rootNode.add(sharon);
    DefaultMutableTreeNode maya = new DefaultMutableTreeNode("Maya");
    sharon.add(maya);
    DefaultMutableTreeNode anya = new DefaultMutableTreeNode("Anya");
    sharon.add(anya);
    sharon.add(new DefaultMutableTreeNode("Bongo"));
    maya.add(new DefaultMutableTreeNode("Muffin"));
    anya.add(new DefaultMutableTreeNode("Winky"));
    DefaultTreeModel model = new DefaultTreeModel(rootNode);
    tree = new JTree(model);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    JScrollPane treeView = new JScrollPane(tree);
    treeView.setPreferredSize(new Dimension(300, 100));
    rightPanel.add(createPanelForComponent(treeView, "JTree"));

    // Create the toggle button.
    toggleDnD = new JCheckBox("Turn on Drag and Drop");
    toggleDnD.setActionCommand("toggleDnD");
    toggleDnD.addActionListener(this);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
    splitPane.setOneTouchExpandable(true);

    add(splitPane, BorderLayout.CENTER);
    add(toggleDnD, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
}

From source file:eu.apenet.dpt.standalone.gui.MessageReportActionListener.java

public void actionPerformed(ActionEvent e) {
    JList xmlEadList = dataPreparationToolGui.getXmlEadList();
    String defaultOutputDirectory = retrieveFromDb.retrieveDefaultSaveFolder();
    StringBuffer stringBuffer = new StringBuffer();

    if (stringBuffer.toString() != null && stringBuffer.toString().equals(""))
        LOG.info(stringBuffer.toString());
    if (stringBuffer.toString() == null)
        LOG.info("StringBuffer is null");
    if (stringBuffer.toString().equals(""))
        LOG.info("StringBuffer is empty");
    for (Object selectedValue : xmlEadList.getSelectedValues()) {
        File selectedFile = (File) selectedValue;
        String filename = selectedFile.getName();
        FileInstance fileInstance = fileInstances.get(filename);

        //todo: do we really need this?
        filename = filename.startsWith("temp_") ? filename.replace("temp_", "") : filename;

        if (!fileInstance.getConversionErrors().isEmpty() || !fileInstance.getValidationErrors().isEmpty()
                || !fileInstance.getEuropeanaConversionErrors().isEmpty()) {
            stringBuffer.append("========================================\r\n");
            stringBuffer.append(filename);
            stringBuffer.append("\r\n");
            stringBuffer.append("========================================\r\n");
        }//from   w ww  .ja  va 2s  . com
        if (!fileInstance.getConversionErrors().isEmpty()) {
            stringBuffer.append(fileInstance.getConversionErrors());
            stringBuffer.append("\r\n");
        }
        if (!fileInstance.getValidationErrors().isEmpty()) {
            stringBuffer.append(fileInstance.getValidationErrors());
            stringBuffer.append("\r\n");
        }
        if (!fileInstance.getEuropeanaConversionErrors().isEmpty()) {
            stringBuffer.append(fileInstance.getEuropeanaConversionErrors());
            stringBuffer.append("\r\n");
        }
    }
    try {
        if (stringBuffer.toString().equals(""))
            JOptionPane.showMessageDialog(parent, labels.getString("noReportData"),
                    labels.getString("noReportDataHeader"), JOptionPane.INFORMATION_MESSAGE, Utilities.icon);
        else {
            FileUtils.writeStringToFile(new File(defaultOutputDirectory + "/report.txt"),
                    stringBuffer.toString());
            JOptionPane.showMessageDialog(parent,
                    MessageFormat.format(labels.getString("filesInOutput"), defaultOutputDirectory) + ".",
                    labels.getString("fileSaved"), JOptionPane.INFORMATION_MESSAGE, Utilities.icon);
        }
    } catch (IOException ex) {
        java.util.logging.Logger.getLogger(MessageReportActionListener.class.getName())
                .log(java.util.logging.Level.SEVERE, null, ex);
    }
}

From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilter.java

private void shiftValues(JList source, JList destination) {
    Object[] values = source.getSelectedValues();
    DefaultListModel sourceModel = (DefaultListModel) source.getModel();
    DefaultListModel destinationModel = (DefaultListModel) destination.getModel();

    for (Object value : values) {
        sourceModel.removeElement(value);
        destinationModel.addElement(value);
    }//from w w w.j  a  v  a2  s  . c o m
}

From source file:gtu._work.mvn.MavenRepositoryUI.java

void defaultJListClick(final JList jList, MouseEvent evt) {
    if (jList.getLeadSelectionIndex() == -1) {
        return;//from  w  w w.jav  a 2  s  .c  o m
    }

    //?
    if (jList.getSelectedValues().length > 1) {
        defaultPopupMenu(ListUtil.getList(jList.getSelectedValues(), PomFile.class), jList, evt);
        return;
    }

    //?
    final PomFile pomFile = (PomFile) JListUtil.getLeadSelectionObject(jList);
    this.defaultPopupMenu(Arrays.asList(pomFile), jList, evt);
    if (JListUtil.newInstance(jList).isCorrectMouseClick(evt)) {
        this.showPomInfo(pomFile);
    }
}

From source file:com.projity.pm.graphic.chart.ChartLegend.java

JList getListInstance(boolean cost) {
    final JList list = new JList() { // do not want to update the UI. see below also
        private static final long serialVersionUID = 1L;

        public void updateUI() {
            if (!Environment.isNewLook())
                super.updateUI();
        }/*from  w  w w  . ja  v  a  2s.  c  o  m*/
    };
    if (Environment.isNewLook()) // The PLAF can override the custom renderer. This avoids that
        list.setUI(new BasicListUI());
    list.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    list.setCellRenderer(new ListRenderer());
    setListFields(list, cost);
    if (!simple) {
        list.setSelectedIndex(0); // start off with first choice selected         
        list.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (chartInfo.isRestoring()) // don't want to listen if updating from workspace
                    return;
                if (e.getValueIsAdjusting() == false) {
                    chartInfo.setTraces(list.getSelectedValues());
                }
            }
        });
    }

    return list;
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

private JPanel buildBotones(final Dimension dimension2, final JList left, final JList right) {

    JPanel botones = new JPanel(new GridBagLayout());
    botones.setPreferredSize(dimension2);
    JButton derecha = new JButton(LogicConstants.getIcon("button_right"));
    derecha.setBorderPainted(false);//www.ja  v  a2 s .c o m
    derecha.setOpaque(false);
    derecha.setContentAreaFilled(false);
    derecha.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            cambios = true;
            for (Object o : left.getSelectedValues()) {
                ((DefaultListModel) right.getModel()).addElement(o);
                rightItems.add(o);
            }
            for (Object o : left.getSelectedValues()) {
                ((DefaultListModel) left.getModel()).removeElement(o);
                leftItems.remove(o);
            }
        }
    });
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;
    botones.add(derecha, gbc);
    izquierda.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            cambios = true;
            for (Object o : right.getSelectedValues()) {
                ((DefaultListModel) left.getModel()).addElement(o);
                leftItems.add(o);
            }
            for (Object o : right.getSelectedValues()) {
                ((DefaultListModel) right.getModel()).removeElement(o);
                rightItems.remove(o);
            }
        }
    });
    gbc.gridy++;
    izquierda.setBorderPainted(false);
    izquierda.setOpaque(false);
    izquierda.setContentAreaFilled(false);
    botones.add(izquierda, gbc);
    botones.setOpaque(false);
    return botones;
}

From source file:org.gumtree.vis.awt.AbstractPlotEditor.java

private JPanel createHelpPanel() {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = plot.getHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);//from   ww  w .j ava  2 s .  c  om
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;
}

From source file:org.gumtree.vis.hist2d.Hist2DChartEditor.java

private JPanel createHelpPanel(JFreeChart chart) {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = new Hist2DHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);//from w w  w  .  j a va2s  .co m
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;

}

From source file:SuitaDetails.java

private void showLib() {
    JScrollPane jScrollPane1 = new JScrollPane();
    JList jList1 = new JList();
    JPanel libraries = new JPanel();
    jScrollPane1.setViewportView(jList1);
    GroupLayout layout = new GroupLayout(libraries);
    libraries.setLayout(layout);//from  ww  w  .  ja  va  2s  . 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));
        for (String st : globallib) {
            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();
        globallib = new String[val.length];
        for (int s = 0; s < val.length; s++) {
            globallib[s] = val[s].toString();
        }
    }

}

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);/* w  ww .ja  v  a2  s.c  o  m*/
    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);
    }
}