JTree Selection

Discussion in 'Java' started by Jason Cavett, Nov 20, 2006.

  1. Jason Cavett

    Jason Cavett Guest

    It is easy to determine what node has been selected in a JTree, but I
    cannot determine when a node is not being selected. For example, if
    the user clicks in the white space outside a JTree, every node on the
    tree should be deselected. I know the JTree has a clearSelection()
    method, but I can't figure out how to determine whether the user
    clicked in the white space or on a node.

    Any help would be much appreciated. Thanks.
    Jason Cavett, Nov 20, 2006
    #1
    1. Advertising

  2. Jason Cavett schrieb:
    > It is easy to determine what node has been selected in a JTree, but I
    > cannot determine when a node is not being selected. For example, if
    > the user clicks in the white space outside a JTree, every node on the
    > tree should be deselected. I know the JTree has a clearSelection()
    > method, but I can't figure out how to determine whether the user
    > clicked in the white space or on a node.
    >
    > Any help would be much appreciated. Thanks.
    >

    Who about this: When you click a node usually a propertyChange ist fired. If you monitor the
    mouse clicks an no propertyChange is fired doesn't this mean that the user has clicked in the
    white space?


    Daniel
    Daniel Kastner, Nov 21, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Niederberger
    Replies:
    2
    Views:
    16,404
    Christian Kaufhold
    Jan 7, 2005
  2. Andrew Crowe
    Replies:
    1
    Views:
    4,432
    Andrew Crowe
    Sep 13, 2004
  3. Replies:
    1
    Views:
    6,044
    Vova Reznik
    May 4, 2006
  4. jumpz
    Replies:
    3
    Views:
    605
    Jean-Baptiste Nizet
    Nov 12, 2007
  5. curiousity

    HOWTO autopost the selection list upon selection

    curiousity, Nov 21, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    254
    curiousity
    Nov 21, 2003
Loading...

Share This Page