3

I made a JavaFX application that is launched as a Mac App. I want it to be launched so that the window is always on top of other applications. How can I do this?

Michiel Borkent
  • 34,228
  • 15
  • 86
  • 149
  • Have you tried: `stage.initModality(Modality.APPLICATION_MODAL);` ? [Source](http://stackoverflow.com/questions/12819194/javafx-2-2-stage-always-on-top) – Floris Velleman May 30 '14 at 07:52
  • @FlorisVelleman Isn't that only making the window within the application stay on top, not over all applications? – Michiel Borkent May 30 '14 at 08:46
  • My bad it would seem like you would currently [need a small workaround](http://snipplr.com/view/69423/javafx-always-on-top/) for that as it is not provided [yet.](http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-December/012054.html) – Floris Velleman May 30 '14 at 09:01

1 Answers1

10

As of Java 8u20-ea-b15, and Java 8u6, you can do stage.setAlwaysOnTop(true);

At the time of writing, neither of these are production releases. However, if you are creating a self-contained application, there's nothing to stop you using the ea release and bundling that JVM until these are fully released. (Java 8u6 is probably only a matter of days away.)

James_D
  • 201,275
  • 16
  • 291
  • 322