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

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

问题描述

现在我试图使用以下代码更改org.eclipse.swt.widgets.Button的背景颜色:

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);

这在我在Solaris中运行程序时正常工作,但在Windows中运行代码时什么也不做。这可能吗?如果没有,是否有某种解决方法,将允许我改变背景颜色(即使颜色是一个图像),同时仍然显示在按钮中的文本?谢谢!

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!

推荐答案

你不能。在方法文档 Control.setBackground() ,提到:

You can't. In the documentation of method Control.setBackground(), it is mentioned:

的按钮不能更改。

这篇关于在Windows中更改org.eclipse.swt.widgets背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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