Skip to content

Tianscar/colorful-xcursor

Repository files navigation

Colorful Xcursor

Colorful custom cursor support for Java XAWT (AWT/X11)

Add the library to your project (gradle)

  1. Add the Maven Central repository (if not exist) to your build file:
repositories {
    ...
    mavenCentral()
}
  1. Add the dependency:
dependencies {
    ...
    implementation 'com.tianscar.awt.x11:colorful-xcursor:1.1.2'
}

Running on Java 16+

Add the following lines to the JVM args:

--add-exports java.desktop/sun.awt=ALL-UNNAMED
--add-exports java.desktop/sun.awt.X11=ALL-UNNAMED

Usage

Cursor imageCursor   = ColorfulXCursor.createImageCursor(Image cursor, Point hotSpot, String name);
Cursor fontCursor    = ColorfulXCursor.getFontCursor(int type);
Cursor libraryCursor = ColorfulXCursor.getLibraryCursor(String name);

JavaDoc
A simple example

Comparison

Original XAWT Custom Cursor Colorful Xcursor

License

MIT (c) Karstian Lee

Dependencies

Apache-2.0 jnr-ffi

Resources be used for test

pencils.jpg is cropped from https://en.wikipedia.org/wiki/Color#/media/File:Colouring_pencils.jpg, the source image licensed under CC-BY-SA.