title: Java - Array JList, Print out a Value
body: <p>I have a JList that is filled with an Array. I just want to print the value when the user selects something in the list and presses a button. I know it's something to do with getSelectedValues. When I searched online I got solutions to JLists filled with addItems but not when filled with an Array. </p>
  
  <p>This is the code for the button at the moment: </p>
  
  <pre><code>    public void actionPerformed(ActionEvent evt) {
                  Object[] selected = FilmList.getSelectedValues();
                  String[] selectedItems = new String[selected.length];               
                  System.out.println(selectedItems);
  
              }
  </code></pre>
  
  <p>The name of my JList is FilmList and the name of my array is films.
  Thanks guys.</p>