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:
@@ -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--) {
|
||||
|
||||
Reference in New Issue
Block a user