the sample code is as follows
import java.awt.*;
import java.awt.event.*;
class subWindow extends Window{
subWindow(Frame owner){
super(owner);
Button b1=new Button("Press me");
setSize(200,200);
setLayout(new FlowLayout());
setVisible(true);
addFocusListener(new myFocusAdapter(this));
addWindowListener(new myWindowAdapter(this));
addComponentListener(new myComponentAdapter(this));
}
}
class subFrame extends Frame{
subWindow win;
subFrame(){
super();
win=new subWindow(this);
}
}
class myFocusAdapter extends FocusAdapter{
subWindow win;
public myFocusAdapter(subWindow win){
this.win=win;
}
public void focusGained(FocusEvent we){ // this doesn't get invoked
System.out.println("Focus Gained");
}
}
class myWindowAdapter extends WindowAdapter{
subWindow win;
public myWindowAdapter(subWindow win){
this.win=win;
}
public void windowClosing(WindowEvent we){ // this gets invoked
win.dispose();
System.exit(0);
}
public void windowActivated(WindowEvent we){ // this doesn't get invoked
System.out.println("Window activated");
}
}
class myComponentAdapter extends ComponentAdapter{
subWindow win;
public myComponentAdapter(subWindow win){
this.win=win;
}
public void componentMoved(ComponentEvent ce){ // this gets invoked
System.out.println("Component moved");
}
public void componentShown(ComponentEvent ce){ // this doesn't get invoked
System.out.println("Component shown");
}
}
public class transApp{
public static void main(
String args[]){
new subFrame();
}
// hope u can find out the bug in my program
rgds
Shashi