Creating a JavaFX transparent window that ignores mouse and key events

后端 未结 2 1429
醉梦人生
醉梦人生 2021-01-13 22:58

I want to make a JavaFX application that basically overlays the entire user screen with a Canvas object, so basically I can draw anything on the user\'s screen.

2条回答
  •  一生所求
    2021-01-13 23:37

    You may have a look at the Robot class. I have abused its powers many times, although I consider most solutions I used that class for as hacky.

    Maybe you could do it like this:

    1. intercept MouseEvent and save its properties
    2. do your things like drawing
    3. make the Window invisible
    4. invoke the same MouseEvent with the help of Robot
    5. make the Windows visible again

提交回复
热议问题