title: Get multiple Objects from JList and add them to an Array?
body: <p>I'm having trouble with this part of my assignment. </p>
  
  <blockquote>
    <p>This panel also contains a JList object containing the following 10 Canadian universities: Toronto, York, Western, Brock, Guelph, Waterloo, McGill, Concordia, Laval and Macmaster. From that list the user will select 3 universities. A Button labeled "Submit" displayed at the bottom of the panel allows the user to enter the input data coming from textfields and JList object into an array with maximum 100 Student objects. </p>
  </blockquote>
  
  <p>I have created a String Array for 10 universities.</p>
  
  <pre><code>  String uniNames[] = {"Toronto", "York", "Western", "Brock", 
       "Guelph", "Waterloo", "McGill", "Concordia", "Laval", "Macmaster"};
  </code></pre>
  
  <p>That Array of Strings is added to a JList </p>
  
  <pre><code>  JList&lt;String&gt; uniList = new JList&lt;&gt;(uniNames); //(2)
    uniList.setVisibleRowCount(10);
    uniList.setFixedCellHeight(34);
    uniList.setFixedCellWidth(300);
    uniList.setSelectionMode(
       ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    //Add to uniPanelList
    uniPanelList.add(uniList);
    //Add to uniPanel
    uniPanel.add(label3, BorderLayout.NORTH);
    uniPanel.add(uniPanelList, BorderLayout.CENTER);
  </code></pre>
  
  <p>I have created the Submit button, which takes input data</p>
  
  <pre><code>  submitButton.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent submit){
          String name = "", mark = "";
          int markNum;
          if (submit.getSource()==submitButton){ //If submit is pressed
             name = nameInput.getText(); 
             mark = markInput.getText();
             markNum = Integer.parseInt(mark); //Convert String to int
  
  
             //copyList.setListData(colorList.getSelectedValues());
             //String objs = uniList.getSelectedValuesList();
  
  
             //Add information to Array, count++ to keep track
             stuArray[count++] = new Student (name, markNum);
             nameInput.setText(""); //Resets input area
             markInput.setText(""); //Resets input area
             //Set label under submit button
             outputLabel.setText("Student " + count + 
                " out of 100 submitted.");
          }
       }
    });
  </code></pre>
  
  <p>I'm having trouble with the part where the program has to select 3 from my JList, press Submit and it goes into the Array. I have tried getSelectedValuesList(), but it returns an error. </p>
  
  <p>List cannot be converted to String
                 String objs = uniList.getSelectedValuesList();</p>
  
  <p>I'm stuck trying to figure out where to go on from here. Any tips?</p>