adding a WindowListener to a JFrame

Is there a way to add a WindowListener to a JFrame? Maybe not exactly a windowListener, but some kind of listener that will detect when the JFrame is made visible...

sorta like

{

JFrame frame =new JFrame();

frame.addWindowListener();

}

publicvoid windowOpening(WindowEvent we);

//.......

}

[556 byte] By [snoboardera] at [2007-11-27 5:58:59]
# 1
I don't think windowOpening is what you want. Try one of the other methods.
floundera at 2007-7-12 16:34:49 > top of Java-index,Java Essentials,New To Java...
# 2
that part really doesn't matter- there is an error when I add the listener to the Jframeframe.addWindowListener();This error says addWindowListener(java.awt.event.WindowListener) in java.awt.Window cannot be applied to ().That's what I'm trying to get around
snoboardera at 2007-7-12 16:34:49 > top of Java-index,Java Essentials,New To Java...
# 3
Well I'm sorry I didn't read you mind.Try reading the error message. What does it say addWindowListener method requires as a paramater and what parameter are you passing?
floundera at 2007-7-12 16:34:49 > top of Java-index,Java Essentials,New To Java...
# 4
you not pass a WindowListener as parameter. off course you got compiler error.WindowListener wl = new WindowAdapter();frame.addWindowListener(wl);this will ok to compile
j_shadinataa at 2007-7-12 16:34:49 > top of Java-index,Java Essentials,New To Java...