Hi,
I want to bring the JavaFX window on windows to front and activate it. I have figured out that there are 3 possible solutions:
- use the toFront & requestFocus methods of the stage object
- use JNA to access the native Windows functions
- use the WinActivate method of the AutoIt library
In the attached example project (use the 5 seconds delay to hide the form manually) you can find the implementation for the first two solutions. I believe that AutoIt is oversized for my project. Moreover, the WinActivate method is based on the same Windows APIs (at least I think so
), so I didn't try this solution.
However, if you run the example project, you will see that the form remains in the background. What is really striking: the SetForegroundWindow method of the user32 instance returns false.
Btw.: When I use AutoIt and just call
WinActivate("AnyTitle", "") everything works fine. I know I can create a command line tool, and use it with the Shell object. But this is much slower and wouldn't meet my requirements
Any help?