private ProcessDescription[] getNodesToAttach(ProcessDescription[] nodes) { JList nodeList = new JList(nodes); JScrollPane jsp = new JScrollPane(nodeList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); jsp.setPreferredSize(new Dimension(400, 100)); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new GridBagLayout()); nodeList.setBackground(infoPanel.getBackground()); int x = 0; int y = 0; infoPanel.add(new JLabel("Select Nodes:"), new GridBagConstraints(x++, y, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 5, 5), 0, 0)); infoPanel.add(jsp, new GridBagConstraints(x, y++, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0)); int result = JOptionPane.showConfirmDialog(this, infoPanel, "Attach to Nodes", JOptionPane.OK_CANCEL_OPTION);     if (result == JOptionPane.OK_OPTION) { Object[] selected = nodeList.getSelectedValues();
private ProcessDescription[] getNodesToAttach(ArrayList nodes) { Object[] selected = Util.getObjectsFromList(this, nodes, "Attach to Nodes", "Select Nodes:"); if (selected != null) {
  private ProcessDescription[] getNodesToAttach(ProcessDescription[] nodes) {    JList nodeList = new JList(nodes);    JScrollPane jsp =       new JScrollPane(nodeList,                      ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,                      ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);    jsp.setPreferredSize(new Dimension(400, 100));    JPanel infoPanel = new JPanel();    infoPanel.setLayout(new GridBagLayout());    nodeList.setBackground(infoPanel.getBackground());    int x = 0;    int y = 0;    infoPanel.add(new JLabel("Select Nodes:"),                   new GridBagConstraints(x++, y, 1, 1, 0.0, 0.0,                                          GridBagConstraints.WEST,                                          GridBagConstraints.NONE,                                          new Insets(10, 0, 5, 5),                                          0, 0));    infoPanel.add(jsp,                   new GridBagConstraints(x, y++, 1, 1, 0.0, 0.0,                                          GridBagConstraints.WEST,                                          GridBagConstraints.NONE,                                          new Insets(0, 0, 5, 0),                                          0, 0));    int result = JOptionPane.showConfirmDialog(this, infoPanel,                                                "Attach to Nodes",                                               JOptionPane.OK_CANCEL_OPTION);//      if (result == JOptionPane.OK_OPTION) //        return (ProcessDescription[])nodeList.getSelectedValues();//      else//        return null;    if (result == JOptionPane.OK_OPTION) {      Object[] selected = nodeList.getSelectedValues();      ArrayList sel = new ArrayList(selected.length);      for (int i = 0; i < selected.length; i++)        sel.add(selected[i]);      return (ProcessDescription[])sel.toArray(new ProcessDescription[selected.length]);    } else      return null;  }