title: How to set custom size for cursor in swing?
body: <p>I am using the below code to set a custom cursor for JPanel, but when i run the code its enlarging the image which i set for cursor.
  Is there a way to set a userdefined cursor size ?</p>
  
  <pre><code>Toolkit toolkit = Toolkit.getDefaultToolkit();
  BufferedImage erasor=new BufferedImage(10,10, BufferedImage.TYPE_INT_RGB);
  Graphics2D g2d=(Graphics2D) erasor.createGraphics();
  g2d.setPaint(Color.red);
  g2d.drawRect(e.getX(),e.getY() ,10, 10);
  toolkit.getBestCursorSize(10, 10);
  Cursor mcursor=toolkit.createCustomCursor(erasor, new Point(10,10), "Eraser");
  setCursor(mcursor);
  </code></pre>