Problem with declaration of array of jtextarea
When I am declaring the array of jtextarea using the following code:
tabs[i] = new javax.swing.JTextArea();
I am getting the following error:
java.lang.NullPointer开发者_如何学PythonException
the tabs variable is declared as follows outside the procedure in which tabs[i] is declared:
private static javax.swing.JTextArea tabs[];
Can someone please explain me why I am getting this error??
-Thanks in advanceFrom the code you've written so far, you've not yet instanciated your array :
private static javax.swing.JTextArea tabs[] = new javax.swing.JTextArea tabs[5];
Besdies, i would recommand you to use collections instead of arrays, as they are so XXth century (and you have far easier way to handle dynamically sized collections).
精彩评论