Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine2005-01-13 16:03:49 +0000
committerVeronika Irvine2005-01-13 16:03:49 +0000
commit75002a751685d5e4d44cae947784d07933a55bb9 (patch)
tree5ed8b6b9a9ae2d73869709326cba0e9b8ac16f06 /examples
parentb5382ff64d0b46150aeba7fc4f0579a270771fa7 (diff)
downloadeclipse.platform.swt-75002a751685d5e4d44cae947784d07933a55bb9.tar.gz
eclipse.platform.swt-75002a751685d5e4d44cae947784d07933a55bb9.tar.xz
eclipse.platform.swt-75002a751685d5e4d44cae947784d07933a55bb9.zip
*** empty log message ***
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java86
1 files changed, 86 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java
new file mode 100644
index 0000000000..9e60bf5993
--- /dev/null
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet172.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.snippets;
+
+/*
+ * GridLayout snippet: align widgets in a GridLayout
+ *
+ * For a list of all SWT example snippets see
+ * http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets
+ */
+import org.eclipse.swt.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+public class Snippet172 {
+
+public static void main (String [] args) {
+ Display display = new Display ();
+ Shell shell = new Shell (display);
+ GridLayout layout = new GridLayout(4, false);
+ shell.setLayout(layout);
+
+ Button b = new Button(shell, SWT.PUSH);
+ b.setText("LEFT, TOP");
+ b.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("LEFT, CENTER");
+ b.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("LEFT, BOTTOM");
+ b.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("LEFT, FILL");
+ b.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("CENTER, TOP");
+ b.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("CENTER, CENTER");
+ b.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("CENTER, BOTTOM");
+ b.setLayoutData(new GridData(SWT.CENTER, SWT.BOTTOM, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("CENTER, FILL");
+ b.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("RIGHT, TOP");
+ b.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("RIGHT, CENTER");
+ b.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("RIGHT, BOTTOM");
+ b.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("RIGHT, FILL");
+ b.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("FILL, TOP");
+ b.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("FILL, CENTER");
+ b.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("FILL, BOTTOM");
+ b.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true, 1, 1));
+ b = new Button(shell, SWT.PUSH);
+ b.setText("FILL, FILL");
+ b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ shell.open ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
+}
+} \ No newline at end of file

Back to the top