title: Multiple Interval Selection in JList
body: <p>I want to have multiple selections ("columns") from a JList. How do I get the String values of all selected items in the JList and put them in an array/ArrayList of Strings once a ("Export") button is pressed?</p>
  
  <p>I have this in my constructor:</p>
  
  <pre><code>public ColumnList(String[] allColumns) {
      super(new BorderLayout());
      listModel = createListModel(allColumns); // contains all the columns
      list = new JList&lt;String&gt;(listModel);
      list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
      list.setSelectedIndex(0);
      list.setVisibleRowCount(5);
      JScrollPane listScrollPane = new JScrollPane(list);
      exportButton = createExportButton(exportString);
  }
  </code></pre>
  
  <p>And in the same class is this inner class:</p>
  
  <pre><code>class ExportListener implements ActionListener {
      @Override
      public void actionPerformed(ActionEvent e) {
          String columnName = (String) list.getSelectedValue();
          selectedCols.add(columnName); // add to array list
      }
  }
  </code></pre>
  
  <p>Now I know this does not work. This will only work to one selected value. How do I do it for multiple selections?</p>