How to change cursor icon in Java?

前端 未结 5 1423
误落风尘
误落风尘 2020-12-08 14:06

I would like to change the cursor icon to my customized 32x32 image when a Java application is executing. I looked and searched, those I found are just setting cursor on a J

5条回答
  •  情歌与酒
    2020-12-08 14:51

    Call Component.setCursor. The class Cursor as a few predefined cursors.

    A custom cursor image can be created:

    setCursor(Toolkit.getDefaultToolkit().createCustomCursor(
    new ImageIcon("custom.png").getImage(),
    new Point(0,0),"custom cursor"));
    

提交回复
热议问题