在 Windows 中更改 org.eclipse.swt.widgets 背景颜色 [英] Changing org.eclipse.swt.widgets background color in Windows
问题描述
现在我正在尝试使用以下代码更改 org.eclipse.swt.widgets.Button 的背景颜色:
<前>按钮sceneButton = new Button(border, SWT.TOGGLE | SWT.FLAT);SceneButton.setBackground(Color.RED);当我在 Solaris 中运行程序时,这可以正常工作,但当我在 Windows 中运行代码时,它什么也没做.这可能吗?如果没有,是否有某种解决方法可以让我在仍然在按钮中显示文本的同时更改背景颜色(即使颜色"是图像)?谢谢!
你不能.在方法文档中 Control.setBackground()
,有提到:
例如,在 Windows 上,按钮的背景无法更改.
Right now I am trying to change the background color of a org.eclipse.swt.widgets.Button with the following code:
Button sceneButton = new Button(border, SWT.TOGGLE | SWT.FLAT); sceneButton.setBackground(Color.RED);
This works fine when I run the program in Solaris, but does nothing when I run the code in Windows. Is this possible? If not, is there some kind of workaround that would allow me to change the background color (even if the "color" is an image) while still displaying text in the button? Thanks!
You can't. In the documentation of method Control.setBackground()
, it is mentioned:
For example, on Windows the background of a Button cannot be changed.
这篇关于在 Windows 中更改 org.eclipse.swt.widgets 背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!