src/Pure/GUI/gui.scala
changeset 73111 01f4965fd09b
parent 73095 d08cbc36a99a
child 73116 b84887a67cc6
--- a/src/Pure/GUI/gui.scala	Fri Jan 08 22:30:32 2021 +0100
+++ b/src/Pure/GUI/gui.scala	Fri Jan 08 23:59:28 2021 +0100
@@ -18,7 +18,7 @@
 
 object GUI
 {
-  /* Swing look-and-feel */
+  /* Swing look-and-feels */
 
   def find_laf(name: String): Option[String] =
     UIManager.getInstalledLookAndFeels().
@@ -44,6 +44,19 @@
     Platform.is_windows && UIManager.getSystemLookAndFeelClassName() == current_laf()
 
 
+  /* additional look-and-feels */
+
+  class Look_And_Feel(val laf: LookAndFeel) extends Isabelle_System.Service
+  {
+    def setup: Unit = UIManager.installLookAndFeel(laf.getName, laf.getClass.getName)
+  }
+
+  lazy val look_and_feels: List[Look_And_Feel] =
+    Isabelle_System.make_services(classOf[Look_And_Feel])
+
+  def setup_lafs(): Unit = look_and_feels.foreach(_.setup)
+
+
   /* plain focus traversal, notably for text fields */
 
   def plain_focus_traversal(component: Component)
@@ -342,3 +355,6 @@
     }
   }
 }
+
+class FlatLightLaf extends GUI.Look_And_Feel(new com.formdev.flatlaf.FlatLightLaf)
+class FlatDarkLaf extends GUI.Look_And_Feel(new com.formdev.flatlaf.FlatDarkLaf)