SWT- How to change ProgressBar color in Windows?

时间秒杀一切 提交于 2019-12-11 01:17:45

问题


Is there a way to change the color of a ProgressBar's bars in SWT? .setForeground() doesn't seem to work.

If there is not a way to change the color programmatically, is there a way to change ProgressBar's color using the WindowBuilder GUI tools?

Thanks!


回答1:


In SWT there are 3 built-in states, each represented by a color:

progressBar.setState(SWT.ERROR); //Red Fill color. Useful when the task is aborted. 

This state does not support an indeterminate progress bar style (SWT.INDETERMINATE).

progressBar.setState(SWT.PAUSED); //Yellow Fill color.

This state will pause the indeterminate progress bar animation.

progressBar.setState(SWT.NORMAL); //Default state and color as controlled by OS.



回答2:


You can't change the color of the progress bar on Windows using SWT.




回答3:


You can now, using JProgressBar.setForeground( Color )



来源:https://stackoverflow.com/questions/4674678/swt-how-to-change-progressbar-color-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!