Set Tab list for focus transfer : FocusEvent « SWT « Java Tutorial






Set Tab list for focus transfer
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();
  }
}








17.16.FocusEvent
17.16.1.Prevent Tab from traversing out of a controlPrevent Tab from traversing out of a control
17.16.2.Set Tab list for focus transferSet Tab list for focus transfer