lookAndFeelChoices = new ArrayList<>();
for (final LookAndFeelInfo lafInfo : lookAndFeels) {
final String lafName = lafInfo.getName();
@@ -149,6 +161,15 @@ protected void initLookAndFeel() {
// -- Helper methods --
+ /** Assesses whether lookAndFeels contains the laf associated with lafName*/
+ private boolean isRegistered(final LookAndFeelInfo[] lookAndFeels, final String lafName) {
+ for (final LookAndFeelInfo lafInfo : lookAndFeels) {
+ if (lafInfo.getName().equals(lafName))
+ return true;
+ }
+ return false;
+ }
+
/** Tells all known Swing components to change to the new Look & Feel. */
private void refreshSwingComponents() {
// TODO: Change this hacky logic to call a clean UIService API
@@ -202,6 +223,41 @@ private DisplayService displayService() {
return getContext().service(DisplayService.class);
}
+ /**
+ * Sets the application look and feel.
+ *
+ * Useful for setting up the look and feel early on in application startup
+ * routine (e.g., through a macro or script)
+ *
+ *
+ * @param lookAndFeel the look and feel. Supported values include "FlatLaf
+ * Light", "FlatLaf Dark", "FlatLaf Darcula", "FlatLaf
+ * IntelliJ", and JVM defaults
+ * ("javax.swing.plaf.metal.MetalLookAndFeel", etc.)
+ */
+ public static void setupLookAndFeel(final String lookAndFeel) {
+ switch (lookAndFeel) {
+ case FlatLightLaf.NAME:
+ FlatLightLaf.setup();
+ return;
+ case FlatDarkLaf.NAME:
+ FlatDarkLaf.setup();
+ return;
+ case FlatDarculaLaf.NAME:
+ FlatDarculaLaf.setup();
+ return;
+ case FlatIntelliJLaf.NAME:
+ FlatIntelliJLaf.setup();
+ return;
+ default:
+ try {
+ UIManager.setLookAndFeel(lookAndFeel);
+ } catch (final Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
// -- Deprecated methods --
@Deprecated