Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug299492_LabelCenterWrap.java')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug299492_LabelCenterWrap.java86
1 files changed, 43 insertions, 43 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug299492_LabelCenterWrap.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug299492_LabelCenterWrap.java
index 56945a86ee..16690ac2f5 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug299492_LabelCenterWrap.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug299492_LabelCenterWrap.java
@@ -25,62 +25,62 @@ import org.eclipse.swt.widgets.Shell;
public class Bug299492_LabelCenterWrap {
- public static void main(String[] args) {
- Display display = new Display();
- Shell shell = new Shell(display);
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
- createLabel1(shell);
+ createLabel1(shell);
// createLabel2(widget.shell);
- shell.pack();
- shell.open();
- while(!shell.isDisposed()) {
- if(!display.readAndDispatch())
- display.sleep();
- }
- display.dispose();
- }
+ shell.pack();
+ shell.open();
+ while(!shell.isDisposed()) {
+ if(!display.readAndDispatch())
+ display.sleep();
+ }
+ display.dispose();
+ }
- // this is inspired from my real-world application code
- private static void createLabel1(Shell shell) {
- shell.setLayout(new GridLayout(1, true));
- Label label = new Label(shell, SWT.HORIZONTAL | SWT.CENTER | SWT.WRAP);
- label.setText("Very Very Very Long String");
- label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
+ // this is inspired from my real-world application code
+ private static void createLabel1(Shell shell) {
+ shell.setLayout(new GridLayout(1, true));
+ Label label = new Label(shell, SWT.HORIZONTAL | SWT.CENTER | SWT.WRAP);
+ label.setText("Very Very Very Long String");
+ label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
// createLabelInsideComposite(widget.shell);
- }
+ }
- // this doesn't work either
- @SuppressWarnings("unused")
+ // this doesn't work either
+ @SuppressWarnings("unused")
private static void createLabel2(Shell shell) {
- shell.setLayout(new FillLayout());
+ shell.setLayout(new FillLayout());
- Label label = new Label(shell, SWT.HORIZONTAL | SWT.CENTER | SWT.WRAP);
- label.setText("Very Very Very Long String");
+ Label label = new Label(shell, SWT.HORIZONTAL | SWT.CENTER | SWT.WRAP);
+ label.setText("Very Very Very Long String");
// createLabelInsideComposite(widget.shell);
- }
+ }
- // this attempt to workaround the problem by creating two composites
- // to grab the extra horizontal space doesn't work
- @SuppressWarnings("unused")
+ // this attempt to workaround the problem by creating two composites
+ // to grab the extra horizontal space doesn't work
+ @SuppressWarnings("unused")
private static void createLabelInsideComposite(Shell shell) {
- Composite parent = new Composite(shell, SWT.NONE);
- GridLayout gridLayout = new GridLayout(3, false);
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- gridLayout.horizontalSpacing = 0;
- gridLayout.verticalSpacing = 0;
- parent.setLayout(gridLayout);
+ Composite parent = new Composite(shell, SWT.NONE);
+ GridLayout gridLayout = new GridLayout(3, false);
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.horizontalSpacing = 0;
+ gridLayout.verticalSpacing = 0;
+ parent.setLayout(gridLayout);
- Composite leftPanel = new Composite(parent, SWT.NONE);
- leftPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ Composite leftPanel = new Composite(parent, SWT.NONE);
+ leftPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- Label label = new Label(parent, SWT.HORIZONTAL | SWT.CENTER | SWT.WRAP);
- label.setText("Very Very Very Long String");
- label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
+ Label label = new Label(parent, SWT.HORIZONTAL | SWT.CENTER | SWT.WRAP);
+ label.setText("Very Very Very Long String");
+ label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
- Composite rightPanel = new Composite(parent, SWT.NONE);
- rightPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- }
+ Composite rightPanel = new Composite(parent, SWT.NONE);
+ rightPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ }
} \ No newline at end of file

Back to the top