This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Different colored text? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Different colored text?" Watch "Different colored text?" New topic

Different colored text?

Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
Using standard output to the consul can you have it all printed in standard white with certain words printed in a different color to highlight them? I guess I'm asking if there is a way to change the font color on the screen without changing ALL the font color?


~Currently preparing for SCJP6
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30068

Not easily. It might be possible using JNI though. I'm not sure.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

I'm pretty sure it is, but it's not going to be easy. Perhaps you can find an existing 3rd party library that already can do this.

How To Ask Questions How To Answer Questions
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41062
Maybe sending to the console works; coloring text is one of the features it supports.

Something like JChassis ANSI Terminal Controller or javacurses may also fit the bill.
[ November 25, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
Thanks for the suggestions, I had a feeling that Java wouldn't support it as that would cause some OS dependency. I'll have to check out the 3rd party programs!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41062
I briefly tested the JChassis stuff on my Unix console, and it worked fine. I think the javacurses library relies on JNI, so it would be trickier to use.
subject: Different colored text?
Similar Threads
Java Programming Style Guide
Pls. advise other test exam site
Question From JQuest Mock Exam...
remember those default value or status.
Diff. between null & ""