import javax.swing.AbstractAction;
import javax.swing.InputMap;
import javax.swing.JComponent;
+import javax.swing.JDesktopPane;
+import javax.swing.JInternalFrame;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;
import javax.swing.event.InternalFrameAdapter;
}
/**
- * Override to do nothing - let the embedded AlignFrame's be the selected frame
+ * Override to do nothing if triggered from one of the child frames
*/
@Override
public void setSelected(boolean selected) throws PropertyVetoException
{
- // no-op here fixes JAL-3288 (menus close immediately)
+ JDesktopPane desktopPane = getDesktopPane();
+ JInternalFrame fr = desktopPane == null ? null
+ : desktopPane.getSelectedFrame();
+ if (fr == getTopFrame() || fr == getBottomFrame())
+ {
+ /*
+ * patch for JAL-3288 (deselecting top/bottom frame closes popup menu);
+ * it may be possible to remove this method in future
+ * if the underlying Java behaviour changes
+ */
+ if (selected)
+ {
+ moveToFront();
+ }
+ return;
+ }
+ super.setSelected(selected);
}
}