子窗口的问题
子窗口的类
public class Find  implements ActionListener,WindowFocusListener{
	private Frame owner;
	private JDialog fd;
	private JTextComponent findfrom;
	Find(){
		fd = new JDialog(owner , false);
		//其他代码略
	}
	public void setNeedCtl(Frame win,JTextComponent jc){
		owner = win;
		findfrom = jc;
		owner.addWindowFocusListener(this);
		fd.addWindowFocusListener(this);
		fd.setLocation(owner.getLocation().x+100, owner.getLocation().y+250);
	}
	public void hideme(){
		fd.setVisible(false);
	}
	public void showme(){
		fd.setVisible(true);
	}
	public void windowGainedFocus(WindowEvent e) {
//		if(e.getSource()==owner&&this.isVisible()) {
//			this.toFront();
//			this.transferFocus();
//		}
	}
	public void windowLostFocus(WindowEvent e) {
	}
}
在另一个类中(继承了JFrame)
private Find fd = new Find();
fd.fd.setNeedCtl(this, jta);
问题:我想让子窗口有这样的特点(就像“记事本”中的“查找”窗口一样):
1.一直在父窗口的前面。把JDialog设为有模式窗口可以,但是当他打开时父窗口就处于等待状态,也争夺了父窗口的焦点,不好。
2.不会争夺父窗口的焦点。把JDialog设为无模式窗口可以,但是当点击父窗口时,子窗口就被父窗口覆盖,不好。
------解决方案--------------------友情帮顶
很少做东东了
------解决方案--------------------setAlwaysOnTop(true)
------解决方案--------------------可以设置一个监听事件  
用来监听父窗口的状态,从而判断执行不同的操作
------解决方案--------------------
JLayeredPane 能否满足你的要求