Im trying to add a custom cursor to this game I'm trying to make here is the code
JFrame window = new JFrame("First Java Window");
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setResizable(false);
GamePanel gamePanel = new GamePanel();
window.add(gamePanel);
Image cursor = Toolkit.getDefaultToolkit().getImage(getClass().getResource("cursor.png"));
Point hotSpot = new Point(0,0);
Cursor cursorInGame = Toolkit.getDefaultToolkit().createCustomCursor(cursor, hotSpot, "name");
window.setCursor(cursorInGame);
window.pack();
window.setLocationRelativeTo(null);
window.setVisible(true);
gamePanel.startGameThread();
when i run the code it opens everything and the cursor is blank