java swt TitleAreaDialog 添加滚动条
2012-01-10 11:03
323 查看
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
ScrolledComposite scrolledComposite = new ScrolledComposite(area, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
gridData.heightHint = 205;//可调节大小,不可缺少
scrolledComposite.setLayoutData(gridData);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setAlwaysShowScrollBars(true);
Composite container = new Composite(scrolledComposite, SWT.NONE);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
Composite composite = new Composite(container, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
Label label = new Label(composite, SWT.NONE);
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
label.setText("New Label");
Button button = new Button(composite, SWT.NONE);
button.setText("New Button1");
Label label_1 = new Label(composite, SWT.NONE);
label_1.setText("New Label2");
Button button_1 = new Button(composite, SWT.NONE);
button_1.setText("New Button2");
Label label_2 = new Label(composite, SWT.NONE);
label_2.setText("New Label");
Button button_2 = new Button(composite, SWT.NONE);
button_2.setText("New Button3");
Label label_3 = new Label(composite, SWT.NONE);
label_3.setText("New Label");
Button button_3 = new Button(composite, SWT.NONE);
button_3.setText("New Button4");
Label label_5 = new Label(composite, SWT.NONE);
label_5.setText("New Label");
Button button_4 = new Button(composite, SWT.NONE);
button_4.setText("New Button5");
Label label_4 = new Label(composite, SWT.NONE);
label_4.setText("New Label");
Button button_5 = new Button(composite, SWT.NONE);
button_5.setText("6");
Label label_6 = new Label(composite, SWT.NONE);
label_6.setText("New Label");
Button button_6 = new Button(composite, SWT.NONE);
button_6.setText("New Button7");
Label label_7 = new Label(composite, SWT.NONE);
label_7.setText("New Label");
Button button_7 = new Button(composite, SWT.NONE);
button_7.setText("New Button8");
Label label_8 = new Label(composite, SWT.NONE);
label_8.setText("New Label");
Button button_8 = new Button(composite, SWT.NONE);
button_8.setText("New Button9");
scrolledComposite.setContent(container);
scrolledComposite.setMinSize(container.computeSize(SWT.DEFAULT, SWT.DEFAULT));
return area;
}
Composite area = (Composite) super.createDialogArea(parent);
ScrolledComposite scrolledComposite = new ScrolledComposite(area, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
gridData.heightHint = 205;//可调节大小,不可缺少
scrolledComposite.setLayoutData(gridData);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setAlwaysShowScrollBars(true);
Composite container = new Composite(scrolledComposite, SWT.NONE);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
Composite composite = new Composite(container, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
Label label = new Label(composite, SWT.NONE);
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
label.setText("New Label");
Button button = new Button(composite, SWT.NONE);
button.setText("New Button1");
Label label_1 = new Label(composite, SWT.NONE);
label_1.setText("New Label2");
Button button_1 = new Button(composite, SWT.NONE);
button_1.setText("New Button2");
Label label_2 = new Label(composite, SWT.NONE);
label_2.setText("New Label");
Button button_2 = new Button(composite, SWT.NONE);
button_2.setText("New Button3");
Label label_3 = new Label(composite, SWT.NONE);
label_3.setText("New Label");
Button button_3 = new Button(composite, SWT.NONE);
button_3.setText("New Button4");
Label label_5 = new Label(composite, SWT.NONE);
label_5.setText("New Label");
Button button_4 = new Button(composite, SWT.NONE);
button_4.setText("New Button5");
Label label_4 = new Label(composite, SWT.NONE);
label_4.setText("New Label");
Button button_5 = new Button(composite, SWT.NONE);
button_5.setText("6");
Label label_6 = new Label(composite, SWT.NONE);
label_6.setText("New Label");
Button button_6 = new Button(composite, SWT.NONE);
button_6.setText("New Button7");
Label label_7 = new Label(composite, SWT.NONE);
label_7.setText("New Label");
Button button_7 = new Button(composite, SWT.NONE);
button_7.setText("New Button8");
Label label_8 = new Label(composite, SWT.NONE);
label_8.setText("New Label");
Button button_8 = new Button(composite, SWT.NONE);
button_8.setText("New Button9");
scrolledComposite.setContent(container);
scrolledComposite.setMinSize(container.computeSize(SWT.DEFAULT, SWT.DEFAULT));
return area;
}
相关文章推荐
- Swt中实现对TitleAreaDialog窗口的关闭进行监听
- SWT/Jface TitleAreaDialog/TrayDialog 使用
- Java中JTextArea如何添加滚动条
- java 添加windowBuilder的swt、gwt的插件
- TitleAreaDialog/TrayDialog
- Qt---为窗体添加滚动条:QScrollArea
- 如何去掉jface 的TitleAreaDialog 的help图标
- java中如何添加滚动条
- 小试 org.eclipse.jface.dialogs.TitleAreaDialog
- 小试org.eclipse.jface.dialogs.TitleAreaDialog
- SWT/JFace实践:为Composite添加滚动条效果(ScrolledComposite)使用心得
- Java中JTextArea如何添加滚动条
- java为窗体添加滚动条
- 关于java文本框中添加滚动条
- 给QWidget添加滚动条(QScrollArea)
- Qwidget 添加 滚动条 QScrollArea
- java JTextArea添加滚动条及弹出窗口阻塞主程序
- Java中JTextArea添加滚动条
- java SWT:TraverseEvent的理解塈添加TraverseListener实现Composite之间TAB键切换焦点
- Eclipse界面编写实例(1)--扩展TitleAreaDialog