开发者

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 advance


From 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜