Arrgh!! If it's a popup that is being removed, don't remove ALL popups.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1509 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2004-09-29 23:03:26 +00:00
parent 130f67aa04
commit d2875aea5a
@@ -5,9 +5,10 @@ package com.samskivert.swing;
import java.awt.Component;
import javax.swing.JLayeredPane;
import javax.swing.Popup;
/**
* A JLayeredPane that removes all popups when any component is removed.
* A JLayeredPane that removes all popups when a non-popup component is removed.
* This gets around an apparent bug in awt/swing that fucks up hard when
* a component is removed and a popup is up.
*/
@@ -17,6 +18,12 @@ public class SafeLayeredPane extends JLayeredPane
{
Component c = getComponent(index);
// if it's a popup we're removing, leave any other popups in place
if (getLayer(c) == POPUP_LAYER.intValue()) {
super.remove(index);
return;
}
// remove all popups
boolean removedPops = false;
for (int ii=getComponentCount() - 1; ii >= 0; ii--) {