Ski*_*kip 4 java swt state button
我试图以编程方式将SWT按钮设置为"按下"状态.这有可能吗?
更新:
我想要实现的目标 - 渲染将一个按钮在其选定状态下绘制到一个图像上.
Image buttonimg_mouseover = new Image(getDisplay(), 100, 100);
Button button = new Button(parent.parent, SWT.PUSH);
button.setAlignment(SWT.CENTER);
button.setImage(arrowimg);
button.setSize(100, 100);
button.setSelection(true); // doesn't work
GC gcbutton = new GC(buttonimg_mouseover); //draw an image of the button
button.print(gcbutton);
Run Code Online (Sandbox Code Playgroud)
您可以使用以下代码段执行此操作
Button myButton = new Button(parent, SWT.TOGGLE);
myButton.setSelection(true);
Run Code Online (Sandbox Code Playgroud)
但是,这只适用于类型CHECK
,RADIO
或TOGGLE
.
见Javadoc of Button#setSelection(boolean)
.
归档时间: |
|
查看次数: |
3014 次 |
最近记录: |