diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c12413a..02d2250c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ FlatLaf Change Log ## 3.2-SNAPSHOT +#### New features and improvements + +- Added system property `flatlaf.useNativeLibrary` to allow disabling loading of + FlatLaf native library. (issue #674) + #### Fixed bugs - Styling: Fixed scaling of some styling properties (`rowHeight` for Table and diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java index 7901db5b..5d4a7693 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java @@ -150,10 +150,24 @@ public interface FlatSystemProperties *
* Allowed Values {@code false} and {@code true}
* Default {@code true}
+ *
* @since 2.5
*/
String UPDATE_UI_ON_SYSTEM_FONT_CHANGE = "flatlaf.updateUIOnSystemFontChange";
+ /**
+ * Specifies whether FlatLaf native library should be used.
+ *
+ * Setting this to {@code false} disables loading native library, + * which also disables some features that depend on the native library. + *
+ * Allowed Values {@code false} and {@code true}
+ * Default {@code true}
+ *
+ * @since 3.2
+ */
+ String USE_NATIVE_LIBRARY = "flatlaf.useNativeLibrary";
+
/**
* Specifies a directory in which the native FlatLaf libraries have been extracted.
* The path can be absolute or relative to current application working directory.
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeLibrary.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeLibrary.java
index f9daf494..4cb8d63d 100644
--- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeLibrary.java
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeLibrary.java
@@ -33,6 +33,7 @@ import com.formdev.flatlaf.util.SystemInfo;
*/
class FlatNativeLibrary
{
+ private static boolean initialized;
private static NativeLibrary nativeLibrary;
/**
@@ -45,7 +46,11 @@ class FlatNativeLibrary
}
private static void initialize() {
- if( nativeLibrary != null )
+ if( initialized )
+ return;
+ initialized = true;
+
+ if( !FlatSystemProperties.getBoolean( FlatSystemProperties.USE_NATIVE_LIBRARY, true ) )
return;
String classifier;