@@ -17,39 +17,40 @@ public class GridLayoutSWT {
1717 public static void main (String [] args ) {
1818 Display display = new Display ();
1919 Shell shell = new Shell (display );
20- // Create a new Gridlayout with 2 columns where the 2 column do no need
21- // to be same size
20+
21+ // create a new Gridlayout with two columns
22+ // of different size
2223 GridLayout layout = new GridLayout (2 , false );
24+
2325 // set the layout of the shell
2426 shell .setLayout (layout );
27+
2528 // Create a label and a button
2629 Label label = new Label (shell , SWT .NONE );
2730 label .setText ("A label" );
2831 Button button = new Button (shell , SWT .PUSH );
2932 button .setText ("Press Me" );
3033
31- // Create a new label that will spam two columns
34+ // Create a new label that will span two columns
3235 label = new Label (shell , SWT .BORDER );
3336 label .setText ("This is a label" );
3437 // Create new layout data
35- GridData data = new GridData (SWT .FILL , SWT .LEFT , true ,
36- false , 2 , 1 );
38+ GridData data = new GridData (SWT .FILL , SWT .LEFT , true , false , 2 , 1 );
3739 label .setLayoutData (data );
3840
3941 // Create a new label which is used as a separator
4042 label = new Label (shell , SWT .SEPARATOR | SWT .HORIZONTAL );
43+
4144 // Create new layout data
42- data = new GridData (SWT .FILL , SWT .LEFT , true , false , 2 ,
43- 1 );
45+ data = new GridData (SWT .FILL , SWT .LEFT , true , false , 2 , 1 );
4446 data .horizontalSpan = 2 ;
4547 label .setLayoutData (data );
4648
4749 // Create a right aligned button
4850 Button b = new Button (shell , SWT .PUSH );
4951 b .setText ("New Button" );
5052
51- data = new GridData (SWT .BOTTOM , SWT .LEFT , false , false , 2 ,
52- 1 );
53+ data = new GridData (SWT .BOTTOM , SWT .LEFT , false , false , 2 , 1 );
5354 b .setLayoutData (data );
5455
5556 Spinner spinner = new Spinner (shell , SWT .READ_ONLY );
@@ -70,29 +71,28 @@ public static void main(String[] args) {
7071 composite .setLayoutData (gridData );
7172 composite .setLayout (new GridLayout (1 , false ));
7273
73- Text text = new Text (composite , SWT .NONE );
74- text .setText ("Testing" );
74+ Text txtTest = new Text (composite , SWT .NONE );
75+ txtTest .setText ("Testing" );
7576 gridData = new GridData (SWT .FILL , SWT .FILL , true , false );
76- text .setLayoutData (gridData );
77+ txtTest .setLayoutData (gridData );
7778
78- text = new Text (composite , SWT .NONE );
79- text .setText ("Another test" );
80- // gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
81- // text.setLayoutData(gridData);
79+ Text txtMoreTests = new Text (composite , SWT .NONE );
80+ txtMoreTests .setText ("Another test" );
8281 Group group = new Group (shell , SWT .NONE );
8382 group .setText ("This is my group" );
8483 gridData = new GridData (SWT .FILL , SWT .FILL , true , false );
8584 gridData .horizontalSpan = 2 ;
8685 group .setLayoutData (gridData );
8786 group .setLayout (new RowLayout (SWT .VERTICAL ));
88- text = new Text (group , SWT .NONE );
89- text .setText ("Another test" );
87+ Text txtAnotherTest = new Text (group , SWT .NONE );
88+ txtAnotherTest .setText ("Another test" );
9089
9190 shell .pack ();
9291 shell .open ();
9392 while (!shell .isDisposed ()) {
94- if (!display .readAndDispatch ())
93+ if (!display .readAndDispatch ()) {
9594 display .sleep ();
95+ }
9696 }
9797 display .dispose ();
9898 }
0 commit comments