title: JList.getSelectedValue().toString() returning null?
body: <p>I have a jlist that holds a bunch of username strings. I dont have a lot of experience with this, so here is the code making jlist:</p>
  
  <pre><code>for (int i = 0; i &lt; usersArray.length; i++) {//usersArray is String[] loaded from a list of username strings
      defaultListModelObject.addElement(usersArray[i]);
  }
  
  jlistobject = new JList(defaultListModelObject);
  </code></pre>
  
  <p>There is a button next to the jlist, that when i click it, it calls
  <code>System.out.println(jlistobject.getSelectedValue().toString();</code></p>
  
  <p>then i'm getting a nullpointerexception, that it is unable to print that value. i'm not sure what the null pointer is to, but here is the result:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at avtech.software.minecraft.server.components.UsersListPanel.getSelectedPlayer(UsersListPanel.java:56)
      at avtech.software.minecraft.server.components.PlayerCommandPanel.player(PlayerCommandPanel.java:125)
      at avtech.software.minecraft.server.components.PlayerCommandPanel.access$0(PlayerCommandPanel.java:124)
      at avtech.software.minecraft.server.components.PlayerCommandPanel$3.actionPerformed(PlayerCommandPanel.java:44)
      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.awt.EventQueue.access$200(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.awt.EventQueue$3.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.awt.EventQueue$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)
  </code></pre>
  
  <p>What am I doing wrong? i'm clicking on the item in the list, and clicking this button to have it print, and it has a null pointer effect. should instead i have the value of the list item load to a string object when i click the list item?</p>
  
  <p>please help!</p>