Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JTextPane.setText(String) - New line problem

843789Aug 15 2009 — edited Aug 15 2009
Hello.

I'm usin a JTextPane for a small editor I need.

I'm using it for it's ability to use HTML format codes (<font color = #color>string</font> for a singular line);

Now, It's loading lines from a text file. Then, I made a function to parse the array data into a singular string, and return it.

It's along the lines of
String parseArrayToString(String[] data) {
    String returnString = "";
    for(String s : data)
        returnString += s+"\n";
    return returnString;
}
This worked for JTextArea, but not for this.

Is there any way to do this using JTextPane?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 12 2009
Added on Aug 15 2009
3 comments
2,976 views