CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 1999
    Posts
    1

    JAVA: changing the cursor





    From a post from Zafir Anjum regarding chaning the mouse cursor:



    note that simply calling setCursor() doesn't actually change the cursor. The change is delayed till the next mouse click or movement.


    This does indeed seem to be the case.

    My question is should it then not be possible to turn around post a mouseEvent such as mouseMove. I have tried this by posting Directly to the EventQueue,

    and by calling dispatchEvent on the object in question directly. But to no avail.





  2. #2
    Join Date
    May 1999
    Posts
    93

    Re: JAVA: changing the cursor



    It should certainly be possible to force the change. You'd have to experiment a

    little bit.


    Meantime if you are not afraid to use undocumented / deprecated stuff here's a

    much simple way of changing the cursor. Note: Make sure you use this only for

    top level windows e.g. JFrame.


    frame.getPeer().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));


    This basically calls the native OS which affects the change immediately.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured