src/Pure/GUI/gui.scala
changeset 82556 4f7b5d76340f
parent 82555 35d176c50867
child 82557 a387b02b5320
equal deleted inserted replaced
82555:35d176c50867 82556:4f7b5d76340f
    16   RootPaneContainer, JTextField, JComboBox, LookAndFeel, UIManager, SwingUtilities}
    16   RootPaneContainer, JTextField, JComboBox, LookAndFeel, UIManager, SwingUtilities}
    17 
    17 
    18 import scala.swing.{CheckBox, ComboBox, ScrollPane, TextArea, ListView, Separator}
    18 import scala.swing.{CheckBox, ComboBox, ScrollPane, TextArea, ListView, Separator}
    19 import scala.swing.event.{ButtonClicked, SelectionChanged}
    19 import scala.swing.event.{ButtonClicked, SelectionChanged}
    20 
    20 
       
    21 import com.formdev.flatlaf
       
    22 import com.formdev.flatlaf.FlatLaf
       
    23 
    21 
    24 
    22 object GUI {
    25 object GUI {
    23   /* Swing look-and-feel */
    26   /* Swing look-and-feel */
    24 
    27 
    25   def init_laf(): Unit = com.formdev.flatlaf.FlatLightLaf.setup()
    28   def init_laf(): Unit = flatlaf.FlatLightLaf.setup()
    26 
    29 
    27   def current_laf(): String = UIManager.getLookAndFeel.getClass.getName()
    30   def current_laf(): String = UIManager.getLookAndFeel.getClass.getName()
    28 
    31 
    29   def is_macos_laf(): Boolean =
    32   def is_macos_laf(): Boolean =
    30     Platform.is_macos && UIManager.getSystemLookAndFeelClassName() == current_laf()
    33     Platform.is_macos && UIManager.getSystemLookAndFeelClassName() == current_laf()
    31 
    34 
    32   def is_dark_laf(): Boolean =
    35   def is_dark_laf(): Boolean = FlatLaf.isLafDark()
    33     com.formdev.flatlaf.FlatLaf.isLafDark
       
    34 
    36 
    35   class Look_And_Feel(laf: LookAndFeel) extends Isabelle_System.Service {
    37   class Look_And_Feel(laf: LookAndFeel) extends Isabelle_System.Service {
    36     def info: UIManager.LookAndFeelInfo =
    38     def info: UIManager.LookAndFeelInfo =
    37       new UIManager.LookAndFeelInfo(laf.getName, laf.getClass.getName)
    39       new UIManager.LookAndFeelInfo(laf.getName, laf.getClass.getName)
    38   }
    40   }
   538       ui.put(prop, GUI.imitate_font(font))
   540       ui.put(prop, GUI.imitate_font(font))
   539     }
   541     }
   540   }
   542   }
   541 }
   543 }
   542 
   544 
   543 class FlatLightLaf extends GUI.Look_And_Feel(new com.formdev.flatlaf.FlatLightLaf)
   545 class FlatLightLaf extends GUI.Look_And_Feel(new flatlaf.FlatLightLaf)
   544 class FlatDarkLaf extends GUI.Look_And_Feel(new com.formdev.flatlaf.FlatDarkLaf)
   546 class FlatDarkLaf extends GUI.Look_And_Feel(new flatlaf.FlatDarkLaf)