在java eclipse控制台中更改颜色 [英] Change color in java eclipse console

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

问题描述

有没有办法在eclipse控制台中更改文本颜色?

我不是在谈论选项,而是将颜色从黑色变为红色。

I意思是当我启动我的程序,它执行代码,并在某些时候改变颜色。

例如:

  // code 
if(a == 2)
//将文本颜色更改为红色并继续输入红色

我不是在说guis jframes等我在说Eclipse控制台。

解决方案>

可能通过使用不同的 org.eclipse.ui.console.MessageConsoleStream ,考虑到:


将消息写入消息控制台。

消息控制台可能连接多个流。

每个流可能会以不同的颜色显示


请参阅这个线程



< blockquote>

IOConsoleOutputStream 有一个 setColor(Color newColor),所以我可以 MessageConsole.getInputStream()。setColor(Color newColor)为每种类型的消息。



Is there any way to change text color in eclipse console?
I am not talking about when I go to options and change color from black to for example red.
I mean like when I launch my program and it executes code and at some point it changes color.
For example:

//code  
if (a == 2)  
//change text color to red and continue typing in red color

I am not talking about guis jframes etc. I am talking about Eclipse console.

解决方案

Probably by using a different org.eclipse.ui.console.MessageConsoleStream, considering that:

It is ssed to write messages to a message console.
A message console may have more than one stream connected to it.
Each stream may be displayed in a different color

See this thread:

IOConsoleOutputStream has a setColor(Color newColor), so I can MessageConsole.getInputStream().setColor(Color newColor) for each type of message.

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

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