title: Change JList item colour when I want
body: <p>I'm trying to build a <code>JList</code> in which some of the items have a different background colour than others but only when I want it. </p>
  
  <p>I've been trying to do something like this up it produces errors.</p>
  
  <pre><code> static DefaultListModel&lt;String&gt; model = new DefaultListModel&lt;&gt;();
  
   for(int K=0;K&lt;Collectionsize();K++){
          Jlist.setForeground(Color.red); 
          model.addElement(type 1);
  
          for(int I=0;I&lt;(subcollection.size();I++){
              Jlist.setForeground(Color.white); 
              model.addElement(type 2);
              }
          }
  </code></pre>
  
  <p>There is no pattern between type 1 and 2 so I want change the colour when I want it rather than rely on if statements.</p>
  
  <p>I see a lot of people talking about building custom render classes but I was aiming some something more simple. </p>