站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Eclipse 专题使用SWT Designer中,ToolBar无法拖入CoolBar中

使用SWT Designer中,ToolBar无法拖入CoolBar中

摘要: 使用SWT Designer中,ToolBar无法拖入CoolBar中


我的Eclipse版本3.2.0,SWT Designer pro 5.0.1.
我在Design模式下无法在CoolBar中拖入ToolBar或者ToolItem。
在CoolBar中只能拖入CoolItem,在CoolItem无法拖入ToolBar和ToolItem。

不过可以在Source模式下写代码添加ToolBar,不过不正常了。

代码如下
public class myCoolBar {

private static Text text;
/**
* Launch the application
* @param args
*/
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setLayout(new FillLayout());
shell.setSize(500, 375);
shell.setText("SWT Application");
//

shell.open();

final ViewForm viewForm = new ViewForm(shell, SWT.BORDER);

final CoolBar coolBar = new CoolBar(viewForm, SWT.NONE);



final CoolItem newItemCoolItem_1 = new CoolItem(coolBar, SWT.PUSH);
ToolBar toolBar = new ToolBar(coolBar, SWT.FLAT);

final ToolItem newItemToolItem = new ToolItem(toolBar, SWT.PUSH);
newItemToolItem.setText("New item");
viewForm.setTopLeft(coolBar);


final CoolItem newItemCoolItem = new CoolItem(coolBar, SWT.PUSH);
text = new Text(viewForm, SWT.BORDER);
viewForm.setContent(text);
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}

}


CoolItem 没有对ToolBar进行setControl


我用过但是使用顺序是先COOLBAR COOLITEM TOOLBAR TOOLITEM 但我用它设计了一个GUI退出后再进SWT DESIGNER就会产生故障,我还是回到了ECLIPSE3.12 以后再用3.2的


↑返回目录
前一篇: 侃侃radiobutton
后一篇: 让字体显示为粗体的html写法??