> [JDK-8252015: [macos11] java.awt.TrayIcon requires updates for template 
> images](https://bugs.openjdk.java.net/browse/JDK-8252015)
> 
> ### Problem
> According to Apple's human interface guidelines, developers should use 
> template images for tray icons. This way icons look good when desktop theme 
> or wallpaper change. On the API level, this means setting the 
> `NSImage::isTemplate` flag. Currently there's no way in Java to set this 
> flag. Even if one uses a template (black and transparent pixels only) image, 
> MacOS will treat it as regular image. As a result, the image will not be 
> visible when using dark theme.
> 
> ### Solution:
> * Add a new system property, `java.awt.enableTemplateImages`, to indicate 
> that template images are being used by tray icons.When this property is set, 
> all tray icon images are treated as templates. It's the developers' 
> responsibility to ensure their images are indeed templates. This property 
> allows us to avoid new API and accidental behavior changes
> * Value of this property is passed from Java into `NSImage::setTemplate`
> * We need the tray icon image rendered by MacOS, so we use a button (rather 
> than a view) to host the image
> 
> To do after CSR approval:
> - [ ] Rename property `java.awt.`
> - [ ] Add `TrayIcon` javadoc, use `@systemProperty` tag there

Peter Zhelezniakov has updated the pull request incrementally with two 
additional commits since the last revision:

 - 8252015: fixed failing tests; renamed system property
 - 8252015: Added property description to TrayIcon javadoc

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/481/files
  - new: https://git.openjdk.java.net/jdk/pull/481/files/8e38376b..3027d821

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=481&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=481&range=00-01

  Stats: 206 lines in 4 files changed: 76 ins; 75 del; 55 mod
  Patch: https://git.openjdk.java.net/jdk/pull/481.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/481/head:pull/481

PR: https://git.openjdk.java.net/jdk/pull/481

Reply via email to