Determine which frame called windowActivated

Discussion in 'Java' started by Ben, Mar 19, 2006.

  1. Ben

    Ben Guest

    I have a number of JFrames that call the same
    windowActivated(WindowEvent we). How do I determine which frame caused
    the event.


    Ben, Mar 19, 2006
    1. Advertisements

  2. Ben

    Greg Webber Guest

    I haven't yet used windowActivated, but would this work?

    Object src = we.getSource();

    if(src == oneJFrame){
    }else if(src == otherJFrame){

    Version: 3.1
    GCS/IT/MU/O d-(++) s++: a-- C++++>$ UL++ P+ L+++>++++$ E- W+++>$ N++
    o?>+ K+ w--- O?>O+ M?>+ V- [email protected] PE+ Y+ PGP [email protected] !5 X R+ [email protected] b++>+++ DI++
    D+ G++ e- h! r- y-
    ------END GEEK CODE BLOCK------
    Greg Webber, Mar 19, 2006
    1. Advertisements

  3. The best would be to provide them with separate event handlers. What is
    the point in first merging something (the otherwise independent events),
    and then trying to separate things once they are merged?

    If you really want to mess with one handler only, evaluate the event's

    Thomas Weidenfeller, Mar 20, 2006
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.