summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2012-03-21 15:07:49 -0400
committerCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2012-03-21 15:10:36 -0400
commit6830930de71edad5f8649775f7895007a0d06f17 (patch)
tree6cb9573d89bd184f1483bccbb9e7f9dd112b13bd /examples
parent689db4ba08dcc7facbd51d11e6e55baa5542ebfa (diff)
downloadeclipse.platform.swt-6830930de71edad5f8649775f7895007a0d06f17.tar.gz
eclipse.platform.swt-6830930de71edad5f8649775f7895007a0d06f17.tar.xz
eclipse.platform.swt-6830930de71edad5f8649775f7895007a0d06f17.zip
use horizontal space instead of ScrolledComposite
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithLabelsExample.java121
1 files changed, 58 insertions, 63 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithLabelsExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithLabelsExample.java
index 171c5f25fe..44cf4b3c4b 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithLabelsExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/accessibility/ControlsWithLabelsExample.java
@@ -50,79 +50,75 @@ public class ControlsWithLabelsExample {
public static void main(String[] args) {
display = new Display();
shell = new Shell(display);
- shell.setLayout(new FillLayout());
- final ScrolledComposite sc1 = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.BORDER);
- Composite comp = new Composite(sc1, SWT.NONE);
- sc1.setContent(comp);
- comp.setLayout(new GridLayout(2, true));
+ shell.setLayout(new GridLayout(4, true));
shell.setText("All Controls Test");
- new Label(comp, SWT.NONE).setText("Label for Label");
- label = new Label(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for Label");
+ label = new Label(shell, SWT.NONE);
label.setText("Label");
- new Label(comp, SWT.NONE).setText("Label for CLabel");
- cLabel = new CLabel(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for CLabel");
+ cLabel = new CLabel(shell, SWT.NONE);
cLabel.setText("CLabel");
- new Label(comp, SWT.NONE).setText("Label for Push Button");
- buttonPush = new Button(comp, SWT.PUSH);
+ new Label(shell, SWT.NONE).setText("Label for Push Button");
+ buttonPush = new Button(shell, SWT.PUSH);
buttonPush.setText("Push Button");
- new Label(comp, SWT.NONE).setText("Label for Radio Button");
- buttonRadio = new Button(comp, SWT.RADIO);
+ new Label(shell, SWT.NONE).setText("Label for Radio Button");
+ buttonRadio = new Button(shell, SWT.RADIO);
buttonRadio.setText("Radio Button");
- new Label(comp, SWT.NONE).setText("Label for Check Button");
- buttonCheck = new Button(comp, SWT.CHECK);
+ new Label(shell, SWT.NONE).setText("Label for Check Button");
+ buttonCheck = new Button(shell, SWT.CHECK);
buttonCheck.setText("Check Button");
- new Label(comp, SWT.NONE).setText("Label for Toggle Button");
- buttonToggle = new Button(comp, SWT.TOGGLE);
+ new Label(shell, SWT.NONE).setText("Label for Toggle Button");
+ buttonToggle = new Button(shell, SWT.TOGGLE);
buttonToggle.setText("Toggle Button");
- new Label(comp, SWT.NONE).setText("Label for Editable Combo");
- combo = new Combo(comp, SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for Editable Combo");
+ combo = new Combo(shell, SWT.BORDER);
for (int i = 0; i < 4; i++) {
combo.add("item" + i);
}
- combo.setText("Combo");
+ combo.select(0);
- new Label(comp, SWT.NONE).setText("Label for Read-Only Combo");
- combo = new Combo(comp, SWT.READ_ONLY | SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for Read-Only Combo");
+ combo = new Combo(shell, SWT.READ_ONLY | SWT.BORDER);
for (int i = 0; i < 4; i++) {
combo.add("item" + i);
}
- combo.setText("Combo");
+ combo.select(0);
- new Label(comp, SWT.NONE).setText("Label for CCombo");
- cCombo = new CCombo(comp, SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for CCombo");
+ cCombo = new CCombo(shell, SWT.BORDER);
for (int i = 0; i < 5; i++) {
cCombo.add("item" + i);
}
- cCombo.setText("CCombo");
+ cCombo.select(0);
- new Label(comp, SWT.NONE).setText("Label for List");
- list = new List(comp, SWT.SINGLE | SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for List");
+ list = new List(shell, SWT.SINGLE | SWT.BORDER);
list.setItems(new String[] {"Item0", "Item1", "Item2"});
- new Label(comp, SWT.NONE).setText("Label for Spinner");
- spinner = new Spinner(comp, SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for Spinner");
+ spinner = new Spinner(shell, SWT.BORDER);
- new Label(comp, SWT.NONE).setText("Label for Single-line Text");
- textSingle = new Text(comp, SWT.SINGLE | SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for Single-line Text");
+ textSingle = new Text(shell, SWT.SINGLE | SWT.BORDER);
textSingle.setText("Contents of Single-line Text");
- new Label(comp, SWT.NONE).setText("Label for Multi-line Text");
- textMulti = new Text(comp, SWT.MULTI | SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for Multi-line Text");
+ textMulti = new Text(shell, SWT.MULTI | SWT.BORDER);
textMulti.setText("\nContents of Multi-line Text\n");
- new Label(comp, SWT.NONE).setText("Label for StyledText");
- styledText = new StyledText(comp, SWT.MULTI | SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for StyledText");
+ styledText = new StyledText(shell, SWT.MULTI | SWT.BORDER);
styledText.setText("\nContents of Multi-line StyledText\n");
- new Label(comp, SWT.NONE).setText("Label for Table");
- table = new Table(comp, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for Table");
+ table = new Table(shell, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
table.setHeaderVisible(true);
table.setLinesVisible(true);
for (int col = 0; col < 3; col++) {
@@ -135,8 +131,8 @@ public class ControlsWithLabelsExample {
item.setText(new String [] {"C0R" + row, "C1R" + row, "C2R" + row});
}
- new Label(comp, SWT.NONE).setText("Label for Tree");
- tree = new Tree(comp, SWT.BORDER | SWT.MULTI);
+ new Label(shell, SWT.NONE).setText("Label for Tree");
+ tree = new Tree(shell, SWT.BORDER | SWT.MULTI);
for (int i = 0; i < 3; i++) {
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText("Item" + i);
@@ -145,8 +141,8 @@ public class ControlsWithLabelsExample {
}
}
- new Label(comp, SWT.NONE).setText("Label for Tree with columns");
- treeTable = new Tree(comp, SWT.BORDER | SWT.MULTI);
+ new Label(shell, SWT.NONE).setText("Label for Tree with columns");
+ treeTable = new Tree(shell, SWT.BORDER | SWT.MULTI);
treeTable.setHeaderVisible(true);
treeTable.setLinesVisible(true);
for (int col = 0; col < 3; col++) {
@@ -162,16 +158,16 @@ public class ControlsWithLabelsExample {
}
}
- new Label(comp, SWT.NONE).setText("Label for ToolBar");
- toolBar = new ToolBar(comp, SWT.FLAT);
+ new Label(shell, SWT.NONE).setText("Label for ToolBar");
+ toolBar = new ToolBar(shell, SWT.FLAT);
for (int i = 0; i < 3; i++) {
ToolItem item = new ToolItem(toolBar, SWT.PUSH);
item.setText("Item" + i);
item.setToolTipText("ToolItem ToolTip" + i);
}
- new Label(comp, SWT.NONE).setText("Label for CoolBar");
- coolBar = new CoolBar(comp, SWT.FLAT);
+ new Label(shell, SWT.NONE).setText("Label for CoolBar");
+ coolBar = new CoolBar(shell, SWT.FLAT);
for (int i = 0; i < 2; i++) {
CoolItem coolItem = new CoolItem(coolBar, SWT.PUSH);
ToolBar coolItemToolBar = new ToolBar(coolBar, SWT.FLAT);
@@ -190,8 +186,8 @@ public class ControlsWithLabelsExample {
coolItem.setSize(coolSize);
}
- new Label(comp, SWT.NONE).setText("Label for Canvas");
- canvas = new Canvas(comp, SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for Canvas");
+ canvas = new Canvas(shell, SWT.BORDER);
canvas.setLayoutData(new GridData(64, 64));
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
@@ -213,14 +209,14 @@ public class ControlsWithLabelsExample {
}
});
- new Label(comp, SWT.NONE).setText("Label for Group");
- group = new Group(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for Group");
+ group = new Group(shell, SWT.NONE);
group.setText("Group");
group.setLayout(new FillLayout());
new Text(group, SWT.SINGLE | SWT.BORDER).setText("Text in Group");
- new Label(comp, SWT.NONE).setText("Label for TabFolder");
- tabFolder = new TabFolder(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for TabFolder");
+ tabFolder = new TabFolder(shell, SWT.NONE);
for (int i = 0; i < 3; i++) {
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText("TabItem &" + i);
@@ -230,8 +226,8 @@ public class ControlsWithLabelsExample {
item.setControl(itemText);
}
- new Label(comp, SWT.NONE).setText("Label for CTabFolder");
- cTabFolder = new CTabFolder(comp, SWT.BORDER);
+ new Label(shell, SWT.NONE).setText("Label for CTabFolder");
+ cTabFolder = new CTabFolder(shell, SWT.BORDER);
for (int i = 0; i < 3; i++) {
CTabItem item = new CTabItem(cTabFolder, SWT.NONE);
item.setText("CTabItem &" + i);
@@ -242,20 +238,19 @@ public class ControlsWithLabelsExample {
}
cTabFolder.setSelection(cTabFolder.getItem(0));
- new Label(comp, SWT.NONE).setText("Label for Scale");
- scale = new Scale(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for Scale");
+ scale = new Scale(shell, SWT.NONE);
- new Label(comp, SWT.NONE).setText("Label for Slider");
- slider = new Slider(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for Slider");
+ slider = new Slider(shell, SWT.NONE);
- new Label(comp, SWT.NONE).setText("Label for ProgressBar");
- progressBar = new ProgressBar(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for ProgressBar");
+ progressBar = new ProgressBar(shell, SWT.NONE);
progressBar.setSelection(50);
- new Label(comp, SWT.NONE).setText("Label for Sash");
- sash = new Sash(comp, SWT.NONE);
+ new Label(shell, SWT.NONE).setText("Label for Sash");
+ sash = new Sash(shell, SWT.NONE);
- comp.pack();
shell.pack();
shell.open();
while (!shell.isDisposed()) {