KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 ? 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);
Tags (comma-separated)
Save Edits
Cancel