在 Windows 中更改 org.eclipse.swt.widgets 背景颜色 [英] Changing org.eclipse.swt.widgets background color in Windows

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

问题描述

现在我正在尝试使用以下代码更改 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屋!

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