JOSM: Use FlatLaf dark and light look and feels?

Hello,

I’m the author of the FlatLaf look and feel and wanted to ask whether
the JOSM community is interested in using FlatLaf in JOSM.

FlatLaf is a new modern open-source L&F that looks similar to Darcula/IntelliJ
themes you maybe know from IntelliJ IDEA. It comes with dark and light themes,
supports 3rd party IntelliJ themes, scales on HiDPI displays, runs on all
platforms (Windows, Linux and macOS), uses Mac platform specific key bindings on
macOS and is easy to integrate into existing Swing applications.

While FlatLaf is still young, there are already a lot of applications using it.
Most prominent is NetBeans 11.3.

Here are some screenshots of JOSM running with FlatLaf:

If there is interest in using FlatLaf in JOSM, I’m willing to integrate it,
fix FlatLaf related issues and submit SVN patches.

JOSM with FlafLaf Dark requires some minor color adjustments where hardcoded
colors are used in JOSM UI components.

Here is the patch used to create the screenshots:


Index: ivy.xml
===================================================================
--- ivy.xml	(revision 16222)
+++ ivy.xml	(working copy)
@@ -26,6 +26,7 @@
         <dependency org="org.tukaani" name="xz" rev="1.8" conf="api->default"/>
         <dependency org="com.drewnoakes" name="metadata-extractor" rev="2.13.0" conf="api->default"/>
         <dependency org="ch.poole" name="OpeningHoursParser" rev="0.21.1" conf="api->default"/>
+        <dependency org="com.formdev" name="flatlaf" rev="0.29" conf="api->default"/>
         <!-- sources->sources -->
         <dependency org="org.openstreetmap.jmapviewer" name="jmapviewer" rev="2.13" conf="sources->sources"/>
         <dependency org="javax.json" name="javax.json-api" rev="1.1.4" conf="sources->sources"/>
@@ -36,5 +37,6 @@
         <dependency org="org.tukaani" name="xz" rev="1.8" conf="sources->sources"/>
         <dependency org="com.drewnoakes" name="metadata-extractor" rev="2.13.0" conf="sources->sources"/>
         <dependency org="ch.poole" name="OpeningHoursParser" rev="0.21.1" conf="sources->sources"/>
+        <dependency org="com.formdev" name="flatlaf" rev="0.29" conf="sources->sources"/>
     </dependencies>
 </ivy-module>
Index: src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- src/org/openstreetmap/josm/gui/MainApplication.java	(revision 16222)
+++ src/org/openstreetmap/josm/gui/MainApplication.java	(working copy)
@@ -164,6 +164,9 @@
 import org.openstreetmap.josm.tools.bugreport.BugReportSender;
 import org.xml.sax.SAXException;
 
+import com.formdev.flatlaf.FlatDarkLaf;
+import com.formdev.flatlaf.FlatLightLaf;
+
 /**
  * Main window class application.
  *
@@ -1048,6 +1051,9 @@
     }
 
     static void setupUIManager() {
+        UIManager.installLookAndFeel("FlatLaf Light", FlatLightLaf.class.getName());
+        UIManager.installLookAndFeel("FlatLaf Dark", FlatDarkLaf.class.getName());
+
         String defaultlaf = PlatformManager.getPlatform().getDefaultStyle();
         String laf = LafPreference.LAF.get();
         try {

Thanks,
Karl

Nice :slight_smile: You should file a ticket on josm.openstreetmap.de - there you can find more attention from both users and developers :slight_smile:

Thanks. Crossposted here: https://josm.openstreetmap.de/ticket/19027

Like it :slight_smile: