JavaBob
JavaBob

Reputation: 37

Eclipse console styling

I am looking for a way to print italics out of the Eclipse console. So that some variation of:

System.out.println((Some code)"Hello World");

Outputs:

Hello World

Is this even possible?

Thanks for your help!!

Upvotes: 1

Views: 1921

Answers (1)

Singular1ty
Singular1ty

Reputation: 2615

There are a few options available to you with this, but first off, I'll make it clear that this is not a default Java ability. It depends entirely on the Operating System and the output console you are using (Eclipse, Terminal, Command, etc).

JCurses

You can use the JCurses Library to give you additional functions over the default console window. You can find a tutorial here that might help you.

ANSI Escape Sequences

I found a link here that uses ANSI Escape Sequences to modify the text, and ran the code myself to double-check it worked fine. It certainly changed the font, and there are some escape sequences listed here that might help you.

I believe italics should be System.out.println("\030[3mHello World!\030[0m");

Upvotes: 1

Related Questions