TabListFocusTransfer.java Source code

Java tutorial

Introduction

Here is the source code for TabListFocusTransfer.java

Source

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class TabListFocusTransfer {

    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new RowLayout());

        Button b1 = new Button(shell, SWT.PUSH);
        b1.setText("1");
        Button b2 = new Button(shell, SWT.RADIO);
        b2.setText("2");
        Button b3 = new Button(shell, SWT.RADIO);
        b3.setText("3");
        Button b4 = new Button(shell, SWT.RADIO);
        b4.setText("4");
        Button b5 = new Button(shell, SWT.PUSH);
        b5.setText("5");

        Control[] tabList1 = new Control[] { b2, b1, b3, b5, b4 };
        shell.setTabList(tabList1);

        shell.pack();
        shell.open();

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