File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Formatted text display." Watch "Formatted text display." New topic
Author

Formatted text display.

Ernesto Pye
Greenhorn

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


~void
Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
Your best bet would be a JTextArea (http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTextArea.html), which you can set scrollable in either vertical or horizontal and (non)-editable.
Ernesto Pye
Greenhorn

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
Greenhorn

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.

like,

textarea1.append(required text);
editorpane.setText(textarea1.getText());


Hope this helps you.

All The Best.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formatted text display.