HorizontalSeparatorLabelExample.java Source code

Java tutorial

Introduction

Here is the source code for HorizontalSeparatorLabelExample.java

Source

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
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 HorizontalSeparatorLabelExample {
    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell();
        shell.setLayout(new GridLayout(1, false));

        // Create a horizontal separator
        Label separator = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
        separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

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