Linux: fixed NPE when using java.awt.TrayIcon (issue #405)

(cherry picked from commit 16a769ea61)
This commit is contained in:
Karl Tauber
2021-11-11 12:31:14 +01:00
parent a97076ead5
commit b590f41254
2 changed files with 7 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ FlatLaf Change Log
`JTable.surrendersFocusOnKeystroke` is `true`) and
`TextComponent.selectAllOnFocusPolicy` is `once` (the default) or `always`.
(issue #395)
- Linux: Fixed NPE when using `java.awt.TrayIcon`. (issue #405)
## 1.6.1

View File

@@ -264,6 +264,12 @@ public abstract class FlatLaf
}
};
Toolkit toolkit = Toolkit.getDefaultToolkit();
// make sure that AWT desktop properties are initialized (on Linux)
// before invoking toolkit.addPropertyChangeListener()
// https://github.com/JFormDesigner/FlatLaf/issues/405#issuecomment-960242342
toolkit.getDesktopProperty( "dummy" );
toolkit.addPropertyChangeListener( desktopPropertyName, desktopPropertyListener );
if( desktopPropertyName2 != null )
toolkit.addPropertyChangeListener( desktopPropertyName2, desktopPropertyListener );