3 Replies Latest reply on Aug 17, 2010 6:19 PM by 843807

    Window applet and mouse pointer

      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!
        • 1. Re: Window applet and mouse pointer
          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
          • 2. Re: Window applet and mouse pointer
            google.com "java hide mouse cursor"

            very first link: [first google link|http://www.rgagnon.com/javadetails/java-0440.html]

            I've actually used that method before and it works.
            • 3. Re: Window applet and mouse pointer
              Yes, this code solve my problem. Thank you morgalr and pietblok by your answers,

              here is the link to the game applet:


              best regards.