gpt4 book ai didi

java - 在 java eclipse 控制台中更改颜色

转载 作者:搜寻专家 更新时间:2023-10-31 19:58:15 24 4
gpt4 key购买 nike

有什么方法可以改变 eclipse 控制台中的文本颜色吗?
我不是在谈论何时进入选项并将颜色从黑色更改为例如红色。
我的意思是,当我启动我的程序并执行代码时,它会在某个时候改变颜色。
例如:

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

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

最佳答案

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

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

参见 this thread :

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

关于java - 在 java eclipse 控制台中更改颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5757311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com