Results 1 to 2 of 2
  1. #1
    itaipee is offline Member
    Join Date
    Dec 2008
    Posts
    99
    Rep Power
    0

    Default ActionListenrs - who first

    Hi

    When I have for GUI component 2 or more registered listeners - how can I determine which event will go first?

  2. #2
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    6

    Default In what order are listeners called?

    Listeners are called in an order determined by the object they are added to.
    Often this is the same order as the calls to addListener.
    Often the applications listeners are called after the internal listeners.

    But, in general, you cannot predict the order of calls.
    This deficiency is one reason for Swing's glasspane object and
    the KeyboardFocusManager. They provide hooks to do things
    before the regular event processing begins.

    If you really want to produce a fragile application, you can
    read the code of an addListener method and see what order it creates.
    Your own code could then fetch all the listeners (Component.getListeners())
    and reinsert them in a desired order.
    Good luck.

Posting Permissions

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