It's not a secret anymore!*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Different colored text?" Watch "Different colored text?" New topic
Author

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?

Thanks!


SCJA
~Currently preparing for SCJP6
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

Brian,
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
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41633
    
  55
Maybe sending http://en.wikipedia.org/wiki/ANSI_escape_code 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
Marshal

Joined: Mar 22, 2005
Posts: 41633
    
  55
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different colored text?