Hide mouse cursor for JME canvas painted into a swing panel

Hi all,



I have a JME canvas that I paint into a jpanel, which is located within a JForm.



I want to hide the swing cursor (the white arrow) when the mouse goes over the painted jpanel (because I implemented a software mouse cursor and I don’t want 2 cursor overlap each other).



inputManager.setCursorVisible(false) only works when the application is running standalone, outside the jpanel. The same application painted into the jPanel seems to inherit the panel properties, including the cursor, ignoring the JME setting.



Of course I tried to change the jPanel property and canvas property with the code:



pre type="java"
        Toolkit toolkit = Toolkit.getDefaultToolkit(); 


        java.awt.Image image = toolkit.getImage("");  


        Point hotSpot = new Point(0,0);  


        Cursor emptyCursor = toolkit.createCustomCursor(image, hotSpot, “Empty”); 


        canvas.setCursor(emptyCursor);
/pre



However this approach is very imprecise, because swings seems unable to detect correcty the events that occur on the “painted” panel. This causes problems such as the cursor is hidden only sometimes, and moving slow into the panel.



Any idea? Any approach to suggest?