2

I have the Java Security Manager enabled on my application along with a custom security policy configured in the project directory. I am trying to display a JavaFX window always on top, however with the Security Manager enabled, I am unable to do this.

After reviewing the Javadoc for Stage#setAlwaysOnTop(boolean), I was left with this:

There are differences in behavior between applications if a Security Manager is present. Applications with permissions are allowed to set "always on top" flag on a Stage. In applications without the proper permissions, an attempt to set the flag will be ignored and the property value will be restored to "false".

The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.

I have tried searching online through other sources and the official Oracle JavaFX 8 Javadocs to at least hint me on what permission I should grant in my policy to allow JavaFX windows to display always on top, however I am out of luck.

Note: I do not want to grant my application java.security.AllPermission, I only want to grant my application the permissions that it requires.

Community
  • 1
  • 1
Brandon
  • 409
  • 4
  • 8
  • 18
  • If you were using JavaFX 9+ then you'd use [`javafx.util.FXPermission`](https://openjfx.io/javadoc/12/javafx.base/javafx/util/FXPermission.html). – Slaw Jun 26 '19 at 20:40
  • That's unfortunate since I'm forced to use Java 8 for my application. – Brandon Jun 26 '19 at 20:42
  • Looking at at `openjfx/8u20/rt`, it looks like [they use `AllPermission`](https://hg.openjdk.java.net/openjfx/8u20/rt/file/292cf1a8bc82/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/WindowStage.java#l556) for this, unfortunately. There's a comment mentioning possibly-needed finer-grained control, which I suppose comes in the form of `FXPermission` in FX 9. – Slaw Jun 26 '19 at 21:02

0 Answers0