From d2875aea5a628d87cd6f7bbfe380fa79777cbcd9 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 29 Sep 2004 23:03:26 +0000 Subject: [PATCH] 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 --- .../src/java/com/samskivert/swing/SafeLayeredPane.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/swing/SafeLayeredPane.java b/projects/samskivert/src/java/com/samskivert/swing/SafeLayeredPane.java index fe86e955..6c640939 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/SafeLayeredPane.java +++ b/projects/samskivert/src/java/com/samskivert/swing/SafeLayeredPane.java @@ -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--) {