List of usage examples for org.eclipse.swt.widgets Display getSystemCursor
public Cursor getSystemCursor(int id)
SWT
. 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 ava 2 s . c o m 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(); }
From source file:cookxml.cookswt.util.SwtUtils.java
/** * Setup the system cursor table for the given device. * * @param display the display device.// w w w . ja v a2s . c o m */ private static void setupSystemCursorTable(Display display) { HashMap cursorTable = new HashMap(); for (int i = 0; i <= 21; ++i) { Cursor c = display.getSystemCursor(i); cursorTable.put(c, c); } s_systemCursorTable = cursorTable; }
From source file:org.eclipse.swt.examples.fileviewer.IconCache.java
/** * Loads the resources//from w w w . j a va2 s . c o m * * @param display the display */ public void initResources(Display display) { if (stockImages == null) { stockImages = new Image[stockImageLocations.length]; for (int i = 0; i < stockImageLocations.length; ++i) { Image image = createStockImage(display, stockImageLocations[i]); if (image == null) { freeResources(); throw new IllegalStateException(FileViewer.getResourceString("error.CouldNotLoadResources")); } stockImages[i] = image; } } if (stockCursors == null) { stockCursors = new Cursor[] { null, display.getSystemCursor(SWT.CURSOR_WAIT) }; } iconCache = new HashMap<>(); }