Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can print colorful String using PrintWrite?  RSS feed

 
Daniel Washington
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i wanna print a colorful text in the textarea,but it seems Class String
doesn't have setColor() method,how can i deal with this?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String.setColor() ?
You want to look at javax.swing.JEditorPane, or its subclass JTextPane. These are more complex than TextArea, but they allow for styled text, which TextArea does not.
[ September 12, 2003: Message edited by: Ernest Friedman-Hill ]
 
Daniel Washington
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean Building a program just like MSN,when you input some text,you can
set the text font,color in the chatbox.how can I do that?
you mean the chatbox is build with javax.swing.jeditorpane?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean the chatbox is build with javax.swing.jeditorpane?

I mean that java.awt.TextArea and javax.swing.JTextArea don't support "styled text" (i.e., text with varying colors, fonts, and sizes) while JEditorPane and especially JTextPane do. It's doubtful that any Microsoft product is implemented in Java
 
Daniel Washington
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
haha,surely i know MSN cannot be implemented in java.I just wander how can i build a chating application as same as the MSN using in java?
what is the visual component i choose as the main window in the chat Box?
you mean the JEditorPane is the No 1 choice?
ok,i will try it.thanks a lot
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's doubtful that any Microsoft product is implemented in Java
Oh, some of them are.
My father's wife loves to play some MSN games, and guess what, some of them are Java Applets.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Swing / JFC / AWT forum...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!