rcp 自定义工具栏
来源:互联网 发布:东邪西毒黄药师知乎 编辑:程序博客网 时间:2024/05/22 03:42
//自定义控件
class ComboContribution extends ContributionItem{
private ToolItem toolitem;
private Combo fFindCombo;
private Button upFindbutton;
private Button downFindbutton;
private Button allFindbutton;
private Label label;
public ComboContribution() {
super();
}
protected Control createControl(Composite parent) {
int width = parent.getMonitor().getClientArea().width;
int height = parent.getMonitor().getClientArea().height;
int x = parent.getSize().x;
int y = parent.getSize().y;
if (x > width) {
parent.getSize().x = width;
}
if (y > height) {
parent.getSize().y = height;
}
// Toolkit kit = Toolkit.getDefaultToolkit();
// Dimension screeSize = kit.getScreenSize();
// int width = screeSize.width;
System.out.println("屏幕宽度 : "+width);
// Composite composite = new Composite(parent, SWT.NONE);
parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
// 语言切换关闭所有的视图再展示
PlatformUtils.closeAllView();
parent.setLayout(new FormLayout());
Composite composite = new Composite(parent,SWT.SHADOW_OUT);
composite.setBackground(SWTResourceManager.getColor(220, 20, 60));
composite.setLayoutData(new FormData());
FormData fd_grpWaybill = new FormData();
fd_grpWaybill.bottom = new FormAttachment(0, 50);
fd_grpWaybill.right = new FormAttachment(100, 0);
fd_grpWaybill.top = new FormAttachment(0);
fd_grpWaybill.left = new FormAttachment(0);
composite.setLayoutData(fd_grpWaybill);
//查询框
label = new Label(composite, SWT.NONE);
fFindCombo = new Combo(composite,SWT.NONE);
fFindCombo.setLocation(0, 2);
fFindCombo.setSize(130,20);
System.out.println(" fFindCombo == " + fFindCombo.getBounds());
//向上查
upFindbutton = new Button(composite, SWT.NONE);
upFindbutton.setLocation(135, 2);
upFindbutton.setSize(30,20);
upFindbutton.setText("上查");
upFindbutton.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {
// TODO 自动生成方法存根
}
public void widgetSelected(SelectionEvent e) {
fFindCombo.add(fFindCombo.getText());
}
});
System.out.println(" upFindbutton == " + upFindbutton.getBounds());
//向下查
downFindbutton = new Button(composite, SWT.NONE);
downFindbutton.setLocation(170, 2);
downFindbutton.setSize(30,20);
downFindbutton.setText("下查");
//全部查询
allFindbutton = new Button(composite, SWT.NONE);
allFindbutton.setLocation(205, 2);
allFindbutton.setSize(30,20);
allFindbutton.setText("全部");
toolitem.setWidth(width);
return composite;
}
public void fill(ToolBar parent, int index) {
toolitem = new ToolItem(parent, SWT.SEPARATOR, index);
Control control = createControl(parent);
toolitem.setControl(control);
}
}
class ComboContribution extends ContributionItem{
private ToolItem toolitem;
private Combo fFindCombo;
private Button upFindbutton;
private Button downFindbutton;
private Button allFindbutton;
private Label label;
public ComboContribution() {
super();
}
protected Control createControl(Composite parent) {
int width = parent.getMonitor().getClientArea().width;
int height = parent.getMonitor().getClientArea().height;
int x = parent.getSize().x;
int y = parent.getSize().y;
if (x > width) {
parent.getSize().x = width;
}
if (y > height) {
parent.getSize().y = height;
}
// Toolkit kit = Toolkit.getDefaultToolkit();
// Dimension screeSize = kit.getScreenSize();
// int width = screeSize.width;
System.out.println("屏幕宽度 : "+width);
// Composite composite = new Composite(parent, SWT.NONE);
parent.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
// 语言切换关闭所有的视图再展示
PlatformUtils.closeAllView();
parent.setLayout(new FormLayout());
Composite composite = new Composite(parent,SWT.SHADOW_OUT);
composite.setBackground(SWTResourceManager.getColor(220, 20, 60));
composite.setLayoutData(new FormData());
FormData fd_grpWaybill = new FormData();
fd_grpWaybill.bottom = new FormAttachment(0, 50);
fd_grpWaybill.right = new FormAttachment(100, 0);
fd_grpWaybill.top = new FormAttachment(0);
fd_grpWaybill.left = new FormAttachment(0);
composite.setLayoutData(fd_grpWaybill);
//查询框
label = new Label(composite, SWT.NONE);
fFindCombo = new Combo(composite,SWT.NONE);
fFindCombo.setLocation(0, 2);
fFindCombo.setSize(130,20);
System.out.println(" fFindCombo == " + fFindCombo.getBounds());
//向上查
upFindbutton = new Button(composite, SWT.NONE);
upFindbutton.setLocation(135, 2);
upFindbutton.setSize(30,20);
upFindbutton.setText("上查");
upFindbutton.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {
// TODO 自动生成方法存根
}
public void widgetSelected(SelectionEvent e) {
fFindCombo.add(fFindCombo.getText());
}
});
System.out.println(" upFindbutton == " + upFindbutton.getBounds());
//向下查
downFindbutton = new Button(composite, SWT.NONE);
downFindbutton.setLocation(170, 2);
downFindbutton.setSize(30,20);
downFindbutton.setText("下查");
//全部查询
allFindbutton = new Button(composite, SWT.NONE);
allFindbutton.setLocation(205, 2);
allFindbutton.setSize(30,20);
allFindbutton.setText("全部");
toolitem.setWidth(width);
return composite;
}
public void fill(ToolBar parent, int index) {
toolitem = new ToolItem(parent, SWT.SEPARATOR, index);
Control control = createControl(parent);
toolitem.setControl(control);
}
}
阅读全文
0 0
- rcp 自定义工具栏
- RCP--菜单,工具栏
- RCP菜单工具栏编程详细
- 自定义工具栏
- 自定义工具栏
- RCP,在工具栏上添加其它控件
- RCP:为工具栏(CoolBar)贡献右键菜单
- Rcp之代码方式添加工具栏实例
- [Editing]动态显示、隐藏RCP工具栏
- [Editing]动态显示、隐藏RCP工具栏
- Eclipse RCP 工具栏第一个图标很重要!
- RCP创建菜单栏工具栏(下拉)
- 如何自定义RCP界面
- 如何自定义RCP外观
- 如何自定义RCP外观
- 自定义RCP外观
- 自定义RCP外观
- RCP 自定义启动界面
- mysql-proxy 实现读写分离
- CreateMutex创建互斥内核对象
- gulp--gulp-useref
- 创建一个自己的开源项目
- dll中使用Cstring类型,调用出现Error LNK2001错误
- rcp 自定义工具栏
- 安卓学习历程-第五天
- 深入kubernetes调度之NodeSelector
- IDEA启动tomcat失败Server is not connected. Deploy is not available
- Java Serializable序列号和反序列化
- HttpClient-大量数据处理任务下你做对了吗?
- VS中的路径宏 vc++中OutDir、ProjectDir、SolutionDir各种路径
- JSF复习系列(1)--EL表达式
- VMProtect 与 ASProtect 在VC中的SDK编程