更改java控制台输出的颜色 [英] Change color of java console output

查看:807
本文介绍了更改java控制台输出的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一些方法可以设置我输出到Java控制台的文本的颜色。这是没有关系,如果它是系统特定的程序将只能在我的Windows 7 x64笔记本电脑上运行。

I was wondering if there is someway for me to set the color of the text that I output to the console in Java. It does not matter if it is system specific as the program will only be run on my Windows 7 x64 laptop.

这个问题:在几个星期前被问到,并有一个很好的解决方案(通过@VonC)来解决类似的问题但是它只解决了eclipse中的问题。

This question: Change color in java eclipse console was asked several weeks ago and had a good solution(by @VonC) to a similar problem however it only addressed the issue inside eclipse.

如果我从命令行执行程序,能达到同样的效果吗?如果是这样的话,怎么样?

Can the same effect be achieved if I execute my program from the command line? and if so how?

推荐答案

你可以看看Java Curses Library:
http://sourceforge.net/projects/javacurses/

You can take a look at the Java Curses Library: http://sourceforge.net/projects/javacurses/

这里是一个关于如何使用它的条目:
http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html

Here's an entry on how to use it: http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html

这篇关于更改java控制台输出的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆