Results 1 to 3 of 3
  1. #1
    CuppaCoffee's Avatar
    CuppaCoffee is offline Member
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    80
    Rep Power
    0

    Default Changing the Mouse Cursor

    Now before I start, I know how to change a mouse cursor.. The purpose of the title is dealing with what happens while it changes..

    Say, when I enter a JButton, I'd want the mouse cursor to go from Cursor.DEFAULT_CURSOR to Cursor.HAND_CURSOR. The method I use is this.. to keep it brief:

    Java Code:
    JButton btnQuit = new JButton;
    
    btnQuit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    That being the focus of the code.. When the mouse enters the area of the JButton, it switches to a hand cursor. But the transition is strange.. almost as if it's glitchy. The hand cursor would be, for a split second, in a different location than it's default image location for the cursor.. Like it'd be more to the top-left of the cursor image-space before it sets to its default position.

    Is this normal? I'm wondering if there's a way to smooth the transition or maybe another method with.. clearer results.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Changing the Mouse Cursor

    Probably a matter of the two cursors' hot spot not being at the same coordinates within each cursor. If that's it, then I don't see any obvious workaround.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Changing the Mouse Cursor

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Changing Cursor
    By ridvan in forum AWT / Swing
    Replies: 2
    Last Post: 06-27-2010, 04:11 AM
  2. Custom Cursor Mouse
    By mistercaste in forum Java 2D
    Replies: 3
    Last Post: 03-24-2010, 08:56 PM
  3. Changing the Resizing cursor of the split pane
    By bigj in forum New To Java
    Replies: 2
    Last Post: 02-08-2010, 07:00 AM
  4. button that runs away from the mouse cursor
    By MartinBenes71 in forum New To Java
    Replies: 1
    Last Post: 01-28-2010, 08:00 AM
  5. change the mouse cursor - crosshair cursor
    By cassysumandak in forum New To Java
    Replies: 1
    Last Post: 09-28-2009, 01:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •