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

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

问题描述

有什么方法可以在eclipse控制台中更改文本颜色吗?

当我去选项,并将颜色从黑色更改为例如红色时,我不在说。

意味着像我启动我的程序,它执行代码,并在某种程度上改变颜色。

例如:

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

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

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

推荐答案

可能使用不同的org.eclipse.ui.console.MessageConsoleStream ,请考虑以下因素:

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


被设置为将消息写入消息控制台。

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

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

请参阅此主题


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

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

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

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