Example usage for org.eclipse.swt.widgets Button setOrientation

List of usage examples for org.eclipse.swt.widgets Button setOrientation

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Button setOrientation.

Prototype

public void setOrientation(int orientation) 

Source Link

Document

Sets the orientation of the receiver, which must be one of the constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT.

Usage

From source file:org.eclipse.swt.snippets.Snippet366.java

private static void makeOrientationGroup() {
    Group orientationGroup = new Group(shell, SWT.None);
    orientationGroup.setLayout(new RowLayout());
    orientationGroup.setText("Orientation group");

    final AtomicInteger prevDir = new AtomicInteger(0);
    final Button alignmentButton = new Button(orientationGroup, SWT.ARROW | SWT.RIGHT);
    alignmentButton.addListener(SWT.MouseDown, event -> {
        switch (prevDir.get()) {
        case 0:// w  w w .j av a2s  .  c  o  m
            alignmentButton.setOrientation(SWT.LEFT_TO_RIGHT);
            prevDir.set(1);
            break;
        case 1:
            alignmentButton.setOrientation(SWT.RIGHT_TO_LEFT);
            prevDir.set(0);
            break;
        default:
            break;
        }
    });
}