How do you hide move cursor in Frame?

Is there a way to hide the mouse cursor when it enters the frame?

Here’s a method from my code that does exactly that:


  public void hideCursor(Canvas canvas) {
    Toolkit tk = Toolkit.getDefaultToolkit();
    Image empty = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
    canvas.setCursor(tk.createCustomCursor(empty, new Point(0, 0), ""));
  }

private void showCursor(boolean show) {
	if(show)
		setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
	else
		setCursor(Toolkit.getDefaultToolkit().createCustomCursor(new BufferedImage(1,1,BufferedImage.TYPE_INT_ARGB),new Point(0,0),""));
}

The same… pretty much… I still don’t know why there isnt a predefined cursor like that.