现在我正在尝试使用以下代码更改org.eclipse.swt.widgets.Button的背景颜色:
Button sceneButton = new Button(border, SWT.TOGGLE | SWT.FLAT);
sceneButton.setBackground(Color.RED);
这在我在Solaris中运行程序时工作正常,但在Windows中运行代码时什么都不做.这可能吗?如果没有,是否有某种解决方法可以让我更改背景颜色(即使"颜色"是图像),同时仍然在按钮中显示文字?谢谢!
我目前正在尝试学习如何使用easymock.我有以下代码:
List list = EasyMock.createMock(List.class);
EasyMock.expect(list.size()).andReturn(0);
EasyMock.replay(list);
EasyMock.verify(list);
Run Code Online (Sandbox Code Playgroud)
至少对我来说这应该工作 - 列表初始化时没有任何内容,大小应该返回0.但是我得到以下错误:
java.lang.AssertionError:
Expectation failure on verify:
size(): expected: 1, actual: 0
Run Code Online (Sandbox Code Playgroud)
我觉得这很奇怪,所以我将线路中的0改为1并重新进行测试.我得到了同样的错误.有谁知道我做错了什么?提前致谢!