Swizzbeat Posted November 16, 2013 Share Posted November 16, 2013 (edited) Finally figured out how to do this and I figured others might want to as well, so here's the code! Put this in your global variable declaration: public Image cursor; Have this in your onStart() method: useDefaultPaint(false); try { cursor = ImageIO.read(new URL("YOUR IMAGE URL GOES HERE")); } catch (MalformedURLException e) { log("Error in retrieving mouse cursor!"); } catch (IOException e) { log("Error in retrieving mouse cursor!"); } And then finally put this somewhere in your onPaint() method: int mX = client.getMousePosition().x; int mY = client.getMousePosition().y; g.drawImage(cursor, mX, mY, null); FYI if you use the method moveMouseOutsideScreen() the mouse image you use will appear in the top left of the screen. This is completely normal however it may look a little weird! If you would rather just not have it drawn at all you can do this: if (mX == -1) { //don't draw } else { //draw } Edited February 7, 2014 by Swizzbeat 3 Link to comment Share on other sites More sharing options...
scroll11 Posted November 16, 2013 Share Posted November 16, 2013 O nicee maybe this will be useful later. Link to comment Share on other sites More sharing options...
telfordd Posted February 5, 2014 Share Posted February 5, 2014 Nice will be added this to my script Link to comment Share on other sites More sharing options...
FearMe Posted February 5, 2014 Share Posted February 5, 2014 int mX = client.getMousePosition().x; int mY = client.getMousePosition().y; Do both those not just return -1 if the mouse is outside the screen? Link to comment Share on other sites More sharing options...
Swizzbeat Posted February 7, 2014 Author Share Posted February 7, 2014 int mX = client.getMousePosition().x; int mY = client.getMousePosition().y; Do both those not just return -1 if the mouse is outside the screen? Yes, so if the mouse is currently outside of the screen the cursor will appear at the top left of the game window (however it is still technically outside). Link to comment Share on other sites More sharing options...
FearMe Posted February 7, 2014 Share Posted February 7, 2014 Yes, so if the mouse is currently outside of the screen the cursor will appear at the top left of the game window (however it is still technically outside). But then you can just check if its at (-1, -1) and don't render it when it is, so you don't get the image on the top left :P Link to comment Share on other sites More sharing options...
Swizzbeat Posted February 7, 2014 Author Share Posted February 7, 2014 But then you can just check if its at (-1, -1) and don't render it when it is, so you don't get the image on the top left client.isMouseOutsideScreen() could also be used :p I should probably add that but meh, when I feel like it I will. Link to comment Share on other sites More sharing options...
Cinnamon Posted February 7, 2014 Share Posted February 7, 2014 Your the man. Link to comment Share on other sites More sharing options...
Parameter Posted February 8, 2014 Share Posted February 8, 2014 You might as well use if (x != -1) { //draw} for I don't think there's anything you'd put in the don't draw statement ;) 1 Link to comment Share on other sites More sharing options...