how to prevent JDialog from going behind the screen while switching tabs?

I have a JTabbedPane with two tabs. A JInternalframe is brought up from one of the tabs. This JInternalframe has a pop up dialog which is modal to the JInternalframe, but non modal to the tabs i.e. it allows switching between the tabs.

But when I switch between the tabs, the pop up is going behind the JInternalframe alternatively on linux OS. But this works fine on windows OS. Is there any solution for this?

On hierarchy change, this is the code I have added.

public void hierarchyChanged(HierarchyEvent e) {

super.hierarchyChanged(e);

System.out.println("hierarchyChanged:"+this);

if (e.getComponent().isShowing()) {

System.out.println("showing");

setExtendedState(NORMAL);

setLocationRelativeTo(comp);

setAlwaysOnTop(true);

toFront();

setVisible(true);

}else {

System.out.println("not showing");

setVisible(false);

}

}

If anyone has any idea about this problem, pls do reply.

Message was edited by:

SSVN

Message was edited by:

SSVN

[1079 byte] By [SSVNa] at [2007-11-27 8:25:41]
# 1
perhaps a windowListener, and in windowDeactivated bring it to the front?
Michael_Dunna at 2007-7-12 20:14:46 > top of Java-index,Desktop,Core GUI APIs...
# 2
I tried to call toFront() in windowDeactivated(). In that case, when I switch tabs the pop up will get displayed for the other tab also. I dont want this behaviour. Is there any other way?
SSVNa at 2007-7-12 20:14:46 > top of Java-index,Desktop,Core GUI APIs...