• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Formatted text display.

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Talk about a bump!

Any ideas? School's now off, and I'm still wondering about this.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!