mysterious Jlist behaviour (valuechanged)

Discussion in 'Java' started by wnstnsmith@yahoo.com, Nov 29, 2003.

  1. Guest

    Dear all,

    Every time I klick in a Jlist to change its value, it turns out
    valueChanged() is called twice, both times with the new seleceted index
    value. I am not doubleclicking inadvertently.
    I don't like it, because alle the work that is to be done on changing the
    selected value is carried out twice as well, of course. Does anybody know
    why two valauechanged events are sent and how I can get rid of this
    behaviour?

    tia,

    Winston
     
    , Nov 29, 2003
    #1
    1. Advertising

  2. Lee Weiner Guest

    In article <3fc7fffa$0$4393$4all.nl>, wrote:
    >Dear all,
    >
    >Every time I klick in a Jlist to change its value, it turns out
    >valueChanged() is called twice, both times with the new seleceted index
    >value. I am not doubleclicking inadvertently.
    >I don't like it, because alle the work that is to be done on changing the
    >selected value is carried out twice as well, of course. Does anybody know
    >why two valauechanged events are sent and how I can get rid of this
    >behaviour?
    >
    >tia,
    >
    >Winston


    I don't know if you can get rid of this behavior, but you can deal with it.
    In the valueChanged() method, there is a ListSelectionEvent object available,
    which contains a getValueIsAdjusting() method. Call this method and, if it
    returns true, do not execute your code. If it returns false, execute the
    code.

    Lee Weiner
    lee AT leeweiner DOT org
     
    Lee Weiner, Nov 29, 2003
    #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. Bruce W.1

    Mysterious cookie problem

    Bruce W.1, Jul 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    388
    Michal A. Valasek
    Jul 29, 2003
  2. =?Utf-8?B?Y2luZHk=?=
    Replies:
    0
    Views:
    521
    =?Utf-8?B?Y2luZHk=?=
    Sep 21, 2006
  3. =?Utf-8?B?cmZpbmNo?=

    ValueChanged Event Doesn't Fire

    =?Utf-8?B?cmZpbmNo?=, Oct 26, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,057
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Oct 26, 2006
  4. gsz

    valueChanged

    gsz, Aug 2, 2007, in forum: Java
    Replies:
    0
    Views:
    433
  5. gsz
    Replies:
    1
    Views:
    703
    Andrew Thompson
    Aug 9, 2007
Loading...

Share This Page