This site requires JavaScript, please enable it in your browser!
Greenfoot back
Gazzzah
Gazzzah wrote ...

2012/2/3

Hide the mouse

Gazzzah Gazzzah

2012/2/3

#
I've created an object that follows the mouse and rotates around the player to act as a custom cursor. That all works fine. Just one thing remains... I need to be able to hide the white arrow cursor, make it invisible while onscreen. Most scenarios I've seen that alter the mouse curser have tonnes of code. Is there anything I can do to simply hide the mouse.
Duta Duta

2012/2/3

#
//You'll need these import statements:
import greenfoot.core.*;
import javax.swing.*;
import java.awt.*;

//Then just do this:
JPanel panel = WorldHandler.getInstance().getWorldCanvas();
GreenfootImage image = new GreenfootImage(1, 1);
Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(image.getAwtImage(), new Point(0, 0), "");
panel.setCursor(cursor);
I don't think I forgot any import statements, tell me if otherwise.
Gazzzah Gazzzah

2012/2/3

#
YAY! That totally worked. Thankyou good sir.
You need to login to post a reply.