Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java')
-rwxr-xr-xexamples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java
new file mode 100755
index 0000000000..7c1b36d385
--- /dev/null
+++ b/examples/org.eclipse.swt.examples/org/eclipse/swt/examples/helloworld/HelloWorld4.java
@@ -0,0 +1,35 @@
+package org.eclipse.swt.examples.helloworld;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+*/
+
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.layout.*;
+import java.util.ResourceBundle;
+
+/*
+* This example builds on HelloWorld2 and demonstrates how to resize the
+* Label when the Shell resizes using a Layout.
+*/
+
+public class HelloWorld4 {
+ private static ResourceBundle resHello = ResourceBundle.getBundle("examples_helloworld");
+
+public static void main (String [] args) {
+ Display display = new Display ();
+ Shell shell = new Shell (display);
+ shell.setLayout(new FillLayout());
+ Label label = new Label (shell, SWT.CENTER);
+ label.setText (resHello.getString("Hello_world"));
+ shell.pack ();
+ shell.open ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
+}
+}

Back to the top