SWT Java Tutorial

(From ST API)
Returns a point which is the result of converting the argument, which is specified in display relative coordinates, to coordinates relative to the receiver.

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class ControlRelativePosition {
  public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout());
    Button button = new Button(shell, SWT.PUSH | SWT.LEFT);
    button.setText("Button");
    System.out.println("toControl: " + button.toControl(100, 200));
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
  }
}