E
Ed
Using Java 5.0
I'm trying to prepare a DefaultStyledDocument array so that I can then
insert formatted text into each element. My compiler complains about my
initializing code. Wherever each element of the array is referenced '[0]' it
says a closing square bracket "]" is expected instead of a digit.
Can someone tell me what I'm doing wrong or point me to help towards a
solution. Thanks.
A part of my code follows:
class PublishStats extends JFrame
{
JFrame f = new JFrame("BJ");
StyleContext sc = new StyleContext();
//Declare an array "doc"
DefaultStyledDocument[] doc;
//Instantiate and array "doc"
DefaultStyledDocument[] doc = new DefaultStyledDocument[5];
//Initialize each element of array "doc"
doc[0] = new DefaultStyledDocument(sc);
doc[1] = new DefaultStyledDocument(sc);
doc[2] = new DefaultStyledDocument(sc);
doc[3] = new DefaultStyledDocument(sc);
doc[4] = new DefaultStyledDocument(sc);
I'm trying to prepare a DefaultStyledDocument array so that I can then
insert formatted text into each element. My compiler complains about my
initializing code. Wherever each element of the array is referenced '[0]' it
says a closing square bracket "]" is expected instead of a digit.
Can someone tell me what I'm doing wrong or point me to help towards a
solution. Thanks.
A part of my code follows:
class PublishStats extends JFrame
{
JFrame f = new JFrame("BJ");
StyleContext sc = new StyleContext();
//Declare an array "doc"
DefaultStyledDocument[] doc;
//Instantiate and array "doc"
DefaultStyledDocument[] doc = new DefaultStyledDocument[5];
//Initialize each element of array "doc"
doc[0] = new DefaultStyledDocument(sc);
doc[1] = new DefaultStyledDocument(sc);
doc[2] = new DefaultStyledDocument(sc);
doc[3] = new DefaultStyledDocument(sc);
doc[4] = new DefaultStyledDocument(sc);