List of usage examples for org.eclipse.swt.widgets Button setCursor
public void setCursor(Cursor cursor)
From source file:CursorSetControl.java
public static void main(String[] args) { Display display = new Display(); Cursor cursor = new Cursor(display, SWT.CURSOR_HAND); Shell shell = new Shell(display); shell.open();//w ww . jav a 2 s. c o m final Button b = new Button(shell, 0); b.setBounds(10, 10, 200, 200); b.setCursor(cursor); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } cursor.dispose(); display.dispose(); }
From source file:Snippet44.java
public static void main(String[] args) { Display display = new Display(); final Cursor cursor = new Cursor(display, SWT.CURSOR_HAND); Shell shell = new Shell(display); shell.open();/* ww w . j a v a 2 s .c om*/ final Button b = new Button(shell, 0); b.setBounds(10, 10, 200, 200); b.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { b.setCursor(cursor); } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } cursor.dispose(); display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet44.java
public static void main(String[] args) { Display display = new Display(); final Cursor cursor = display.getSystemCursor(SWT.CURSOR_HAND); Shell shell = new Shell(display); shell.setText("Snippet 44"); shell.open();//w w w.j av a 2 s . com final Button b = new Button(shell, 0); b.setText("Push to set cursor to hand"); Rectangle clientArea = shell.getClientArea(); b.setBounds(clientArea.x + 10, clientArea.y + 10, 200, 200); b.addListener(SWT.Selection, e -> b.setCursor(cursor)); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }