Change the cursor image

Hey All

I want to change the image of my cursor but it’s harder then I thought. What I did nog was adding a picture to the guiNode and when I move my mouse the cursor moves with it (but with some relay). Because of this relay it’s actually impossible to use this methode. The mouse doesn’t move as smooth as a normal mouse.

In jme2 it is possible to change it, but in jme3 it looks like a pain in the ass. Is it possible with niftygui? Or another solution?

Thanks in advance

This is my mousecursor class.

[java]package ui.gui.gui3D;

import com.jme3.asset.AssetManager;

import com.jme3.math.Vector2f;

import com.jme3.ui.Picture;

public class MouseCursor extends Picture {

private AssetManager assetManager;

public MouseCursor(AssetManager assetManager) {


this.assetManager = assetManager;





public void setPosition(Vector2f position) {

super.setPosition(position.x, position.y-31);


public void setNormal() {

super.setImage(assetManager, "Interface/cursor.png", true);


public void setAttack() {

super.setImage(assetManager, "Interface/attackCursor.png", true);




So in my SimpleApplication I do the following

[java]private void initKeys() {

inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_LEFT));

inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_RIGHT));

inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_UP));

inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_DOWN));

inputManager.addMapping("Attack", new MouseButtonTrigger(0));


new MouseAxisTrigger(MouseInput.AXIS_X, true),

new MouseAxisTrigger(MouseInput.AXIS_Y, true),

new MouseAxisTrigger(MouseInput.AXIS_X, false),

new MouseAxisTrigger(MouseInput.AXIS_Y, false));

inputManager.addListener(this, new String[]{"Left", "Right", "Up", "Down", "Attack", "Move"});



public void onAnalog(String name, float value, float tpf) {

if(name.equals("Move")) {




What am I doing wrong?

I just tested it and there was no delay at all. The fake mouse is just as smooth as the real mouse.

Maybe you’re not using the right method of changing it?

I commited a test called TestSoftwareMouse that shows how to do it properly.

Unless I enable vsync, I cannot notice the difference between software and hardware mouse

1 Like