Label nameLabel = new Label(parent, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); nameLabel.setLayoutData(gridData);
Label nameLabel = new Label(parent, SWT.NONE); FormData formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.top = new FormAttachment(0, 0); nameLabel.setLayoutData(formData);In this example, we create a new label widget and set its layout data to a FormData object. The FormData object specifies the position of the label relative to the parent widget using a FormAttachment. The package library for org.eclipse.swt.widgets is part of the Eclipse platform and provides widgets for creating desktop applications with Java.