CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: setCursor()

  1. #1
    Join Date
    Feb 1999
    Posts
    2

    setCursor()



    Using JDK 1.2, I'm finding that I can successfully set the cursor for a Swing component, but not for a Swing Container. Looking at the Component.setCursor() api, I read



    "public void setCursor(Cursor cursor)



    Sets the cursor image to the specified cursor. This cursor image is displayed when the contains method for this component returns true for the current cursor location. Setting the cursor of a Container causes that cursor to be displayed within all of the container's subcomponents, except for any subcomponents that are using a non-default cursor."



    I'm finding that, for the cursor to be displayed in the container's subcomponents, I have to override setCursor in the container and have it call setCursor in the subcomponent.



    Am I missing something?




    java.awt.Component.setCursor() documentation

  2. #2
    Join Date
    May 1999
    Posts
    93

    Re: setCursor()



    There are various problems with setCursor() but the problem you are seeing is

    probably the documented behaviour. Most Swing containers are entirely covered

    by child components. Since the child component covers the container completely,

    any call to setCurson() on the container does not have any effect.


    If you are trying to change the curson of a JFrame, there's an article on this

    site that covers that. See under 'Swing' category.

  3. #3
    Join Date
    Feb 1999
    Posts
    2

    Re: setCursor()



    Well, as I read the documentation, it seems to say that calling setCursor()

    on a container will pass it along to all components. That seems more

    efficient to me than having to call it directly on all components in the

    container.


    I'm not sure I see the message you mention. Are you talking about

    http://www.codeguru.com/java/bbs/55.shtml ?


    Is this the message?

  4. #4
    Join Date
    Apr 1999
    Location
    Portland, OR, USA
    Posts
    29

    Re: setCursor()

    I believe the article you want is:

    http://www.codeguru.com/java/articles/188.shtml

    (You see, I'm trying to find an answer to the same question.)

    Good luck, and happy coding!


    =================================================
    Valerie L. Bradley
    Software Engineer
    Intel Corporation

    * All opinions expressed are mine and not those of my employer.

  5. #5
    Join Date
    Jun 1999
    Posts
    2

    Re: setCursor()

    Thanks for the information .I just needed it .


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