DefaultStyledDocument array problem

E

Ed

In Class PublishStats I have instantiated an array

<<DefaultStyledDocument[] docmnt = new DefaultStyledDocument[20];>>

In method "public void UpdateFields" I have declared

<<DefaultStyledDocument doc = "";>>

Now I trying to fill the array with DefaultStyledDocuments doc1 through
doc20 so I can load each with formatted Strings.

<<
for (int i = 0; i < 20; i++)
{
docmnt = (doc + (i + 1));
}
The above will not compile - says I cannot use the concatination symbol "+".

What am I doing wrong?
 
F

Fred Kleinschmidt

Ed said:
In Class PublishStats I have instantiated an array

<<DefaultStyledDocument[] docmnt = new DefaultStyledDocument[20];>>

In method "public void UpdateFields" I have declared

<<DefaultStyledDocument doc = "";>>

Now I trying to fill the array with DefaultStyledDocuments doc1 through
doc20 so I can load each with formatted Strings.

<<
for (int i = 0; i < 20; i++)
{
docmnt = (doc + (i + 1));
}
The above will not compile - says I cannot use the concatination symbol
"+".

What am I doing wrong?


Well, just what the error message tells you - you cannot use the
concatenation
operator (That's only valid for instances of String).

A DefaultStyledDocument is not a String. It is not text; it is pattern
describing


Perhaps you are trying to concatenate a String representation of a number
to the text contained within some portion of the document?
If so, see the getText() and insertText() methods of DefaultStyledDocument.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top