Hi,
How to get handle of focus window/jdialog/jframe?
/*Test.java*/
import java.awt.*;
public class
Test
{
public static void main(
String args[])
{
Test1 t1 = new Test1();
t1.show();
}
}
/*Test1.java*/
import javax.swing.JDialog;
import java.awt.event.*;
import java.awt.*;
public class Test1 extends JDialog
{
public Test1()
{
setTitle("Test1");
setSize(500,300);
Component comp = this;
addWindowListener(new WindowAdapter()
{
public void windowOpened(WindowEvent e)
{
Test2 t2= new Test2();
t2.show();
}
});
}
}
/*Test2.java*/
import javax.swing.JDialog;
public class Test2 extends JDialog
{
public Test2()
{
setTitle("Test2");
setSize(300,200);
}
}
Now, i want to get the handle of focus window.
In the above example, focus window will be Test2. How to know what is focused window from Test.java?
Thanks,
Susmitha.