tuned;
authorwenzelm
Thu, 11 Jul 2024 13:33:58 +0200
changeset 80553 a171f98c06a7
parent 80552 973d276e130e
child 80554 2ee3d05afb22
tuned;
src/Pure/GUI/gui.scala
--- a/src/Pure/GUI/gui.scala	Thu Jul 11 11:39:36 2024 +0200
+++ b/src/Pure/GUI/gui.scala	Thu Jul 11 13:33:58 2024 +0200
@@ -13,7 +13,7 @@
 import java.awt.font.{FontRenderContext, LineMetrics, TextAttribute, TransformAttribute}
 import java.awt.geom.AffineTransform
 import javax.swing.{ImageIcon, JButton, JDialog, JFrame, JLabel, JLayeredPane, JOptionPane,
-  JTextField, JWindow, JComboBox, LookAndFeel, UIManager, SwingUtilities}
+  RootPaneContainer, JTextField, JWindow, JComboBox, LookAndFeel, UIManager, SwingUtilities}
 
 import scala.swing.{CheckBox, ComboBox, ScrollPane, TextArea, ListView, Label, Separator,
   Orientation}
@@ -365,13 +365,11 @@
   }
 
   def parent_window(component: Component): Option[Window] =
-    ancestors(component).collectFirst({ case x: Window => x })
+    ancestors(component).collectFirst({ case c: Window => c })
 
   def layered_pane(component: Component): Option[JLayeredPane] =
     parent_window(component) match {
-      case Some(w: JWindow) => Some(w.getLayeredPane)
-      case Some(w: JFrame) => Some(w.getLayeredPane)
-      case Some(w: JDialog) => Some(w.getLayeredPane)
+      case Some(c: RootPaneContainer) => Some(c.getLayeredPane)
       case _ => None
     }