Java Code Examples for org.eclipse.swt.widgets.Shell#addMouseMoveListener()

The following examples show how to use org.eclipse.swt.widgets.Shell#addMouseMoveListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractScaleRotateExample.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
/**
 *
 */
public AbstractScaleRotateExample(String title) {
	Display display = new Display();
	shell = new Shell(display, SWT.SHELL_TRIM | SWT.DOUBLE_BUFFERED);
	shell.setText(title);
	shell.setBounds(0, 0, 640, 480);
	shell.setBackground(
			Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

	// open the shell before creating the controllable shapes so that their
	// default coordinates are not changed due to the resize of their canvas
	shell.open();

	shape = createShape(shell);

	shell.addPaintListener(this);
	shell.addMouseListener(this);
	shell.addMouseMoveListener(this);
	shell.addMouseWheelListener(this);
	shell.addListener(SWT.Resize, this);
	shell.redraw(); // triggers a PaintEvent platform independently

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example 2
Source File: SWTLayoutPositionTracker.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	shell = new Shell(display);

	positiongLabel = new Label(shell, SWT.BORDER);
	
	int x= 60;
	int y=20;
	int width =400;
	int height=200;

	positiongLabel.setBounds(x, y, width, height);
	int toolbarSize = 30;

	shell.setBounds(200, 400, width+2*x , height + 2*y +toolbarSize);
	shell.open();
	
	
	
	shell.addMouseMoveListener(e -> showSize(e));
	positiongLabel.addMouseMoveListener(e -> showSize(e));
	
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}