PlainLabelExample.java Source code

Java tutorial

Introduction

Here is the source code for PlainLabelExample.java

Source

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class PlainLabelExample {
    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell();
        shell.setLayout(new GridLayout(1, false));

        // Create a label
        new Label(shell, SWT.NONE).setText("This is a plain label.");

        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }
}