File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Formatted text display. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Formatted text display." Watch "Formatted text display." New topic

Formatted text display.

Ernesto Pye

Joined: Apr 10, 2003
Posts: 13
I am currently working on a Java IRC Client, and I wanted to know if there's a simple way to show formatted text in a scrollable object. I could feasibly parse the incoming messages and change the control codes used on IRC with HTML code to format the text, and use something like a JLabel to show the formatted text. However, I don't seem to be able to scroll through the text of a JLabel.. Is this even possible? Or is there a different object I should look into? Or maybe I need to make a custom control or something?

I'm pretty lost here, so I'd really appreciate it if someone could point me in the right direction.

Thanks in advance

Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
Your best bet would be a JTextArea (, which you can set scrollable in either vertical or horizontal and (non)-editable.
Ernesto Pye

Joined: Apr 10, 2003
Posts: 13
I was looking into that, but I don't seem to be able to display formatted text with it. However, JEditorPane does let me do this. I have a question though, is it possible to just append new HTML formatted text to it? Or do I have to change all the text everytime I want to update the box?
Ernesto Pye

Joined: Apr 10, 2003
Posts: 13
Talk about a bump!

Any ideas? School's now off, and I'm still wondering about this.
sasi kala
Ranch Hand

Joined: Dec 17, 2004
Posts: 68
so many sites saying that "Editorpane will holds the latest text only".

each time when you want to add text, just append it to textarea after that read text from textarea and put it in editorpane.


textarea1.append(required text);

Hope this helps you.

All The Best.
I agree. Here's the link:
subject: Formatted text display.