title: JList adding and removing items (Netbeans)
body: <p>I'm trying to add and remove items from my jList (jList1), but It doesn't work.
  I've searched on stackoverflow for other people with the same problem, but when their problem is solved, I keep getting errors.
  So this is how I declared the jList:</p>
  
  <pre><code>jList1.setModel(new javax.swing.AbstractListModel() {
          String [] strings = lijstItems;
          public int getSize() {
              return strings.length;
          }
          public Object getElementAt (int i) {
              return strings[i];
          }
      });
  </code></pre>
  
  <p>So now I made these buttons to add and remove items from the list:</p>
  
  <pre><code>private void addHostActionPerformed(java.awt.event.ActionEvent evt) {                                        
      // TODO add your handling code here:
  
      DefaultListModel model = (DefaultListModel) jList1.getModel();
      model.add(2, "item");
      // THIS DOES NOT WORK...
  
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>private void deleteHostActionPerformed(java.awt.event.ActionEvent evt) {                                           
      // TODO add your handling code here:
  
  }
  </code></pre>
  
  <p>I've tried so many things, but they don't work!
  Can anyone help me please?</p>
  
  <p>Thanks!</p>