From 14ad4ca7852da1d65398e5bb09864cc6f182d19e Mon Sep 17 00:00:00 2001 From: weisj Date: Wed, 1 Jul 2020 14:58:11 +0200 Subject: [PATCH] Add option to switch between system laf and darklaf in tests. --- core/src/test/java/ui/ComponentDemo.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/src/test/java/ui/ComponentDemo.java b/core/src/test/java/ui/ComponentDemo.java index f7e59f73..a1c9f10b 100644 --- a/core/src/test/java/ui/ComponentDemo.java +++ b/core/src/test/java/ui/ComponentDemo.java @@ -225,6 +225,26 @@ public interface ComponentDemo { isSelected())); } }); + dev.add(new JCheckBoxMenuItem("Darklaf/System Laf"){ + { + setSelected(true); + addActionListener(e -> { + if (isSelected()) { + LafManager.install(); + } else { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + LafManager.updateLaf(); + } catch (ClassNotFoundException + | UnsupportedLookAndFeelException + | IllegalAccessException + | InstantiationException classNotFoundException) { + classNotFoundException.printStackTrace(); + } + } + }); + } + }); return dev; }