This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,899 Users
  • 2,269,649 Discussions


Window applet and mouse pointer

843807 Member Posts: 46,582
edited Aug 17, 2010 2:19PM in Abstract Window Toolkit (AWT)
Hi all!

I am developing a framwork to create educacional games to the OLPC (one laptop per child) project.

So, in this framework the games run in a Window application (JFrame) over a JApplet.

The problem is that I dont know how to hide the mouse pointer that appears over my window applet. I try to use the Toolkit.createCustomCursor(..) and them use the setCursor(..) method, but not work because the security policy.

Anybody have some ideia about how can I solve this problem?

here is a link that demonstrate my application running, and the mouse pointer over all the graphics.

Thank you!


  • pietblok
    pietblok Member Posts: 577
    edited Aug 17, 2010 11:05AM
    What happens? Is some SecurityException thrown? And what exactly do you mean with
    the games run in a Window application (JFrame) over a JApplet.
    As far as I know, but I may be wrong, the following code should just runs fine:
    import java.awt.Point;
    import java.awt.Toolkit;
    import java.awt.image.BufferedImage;
    import javax.swing.JApplet;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.SwingUtilities;
    public class NoCursor extends JApplet {
        private static final long serialVersionUID = 1L;
        public static void main(String[] args) {
    	SwingUtilities.invokeLater(new Runnable() {
    	    public void run() {
    		JApplet applet = new NoCursor();
    		JFrame frame = new JFrame();
    		frame.setSize(500, 400);
        public void init() {
    			new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB),
    			new Point(), "TransparentCursor"));
    	this.add(new JLabel("A text label"));
    Edited by: pietblok on 17-aug-2010 17:04
  • 843807
    843807 Member Posts: 46,582 "java hide mouse cursor"

    very first link: [first google link|]

    I've actually used that method before and it works.
  • 843807
    843807 Member Posts: 46,582
    Yes, this code solve my problem. Thank you morgalr and pietblok by your answers,

    here is the link to the game applet:

    best regards.
This discussion has been closed.