Array Nullpointerexception issue with my first array
<p>I keep getting a NullPointerException for this block of code starting with the private static class StringData and I'm not sure exactly what is wrong with my coding. I have the panel put into a content pane and onto a JFrame. The problem it says I'm having is that the data.color from the array of objects in the class StringData{}. If someone would need better explanation...I can offer that.</p>

<pre><code>Exception in thread "main" java.lang.NullPointerException
    at Display.makeStringData(Display.java:65)
    at Display.&lt;init&gt;(Display.java:51)
    at firstArrayRunner.main(firstArrayRunner.java:5)

private static class StringData {
   // The other problem is apparently that the color of the object Color is not
   // being recognized by my class in which I actually assign values.
   Color color;
   Font font;
   int x, y;
}

private void makeStringData(){
    int width = getWidth();
    int height = getHeight();
    int fontNum;
    for(StringData data: stringData){
    // The problem is in the data.color here
        data.color = Color.getHSBColor( (float)Math.random(), 1.0F, 1.0F ); 
        data.x = -50 + (int)(Math.random() * (width + 45));
        data.y = (int)(Math.random() * (height + 20));
        fontNum = (int)(Math.random() * 5);
        data.font = fonts[fontNum];
    }
}
</code></pre>
