Transparenter Cursor unter SWT

Thomas Darimont

Erfahrenes Mitglied
Hallo!

Code:
/**
 *
 */
package de.tutorials;

import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
 * @author Tom
 */
public class NoCursorExample {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setText("NoCursorExample");

        PaletteData palette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
        ImageData data = new ImageData(1, 1, 24, palette);
        // Auskommentieren für unsichtbaren Cursor...
        // data.transparentPixel = 0;

        shell.setCursor(new Cursor(display, data, 0, 0));

        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    }
}

Gruß Tom
 
Zurück