Win a copy of Terraform in Action this week in the Cloud forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

how can print colorful String using PrintWrite?

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the Swing / JFC / AWT forum...
 
reply
    Bookmark Topic Watch Topic
  • New Topic