How to listen to graphic environment or device changes in java

后端 未结 1 1013
小鲜肉
小鲜肉 2021-01-22 03:39

In java one can get the current graphics environment using

GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();


        
相关标签:
1条回答
  • 2021-01-22 04:24

    A quick and dirty solution would be to batch the execution of an small java program, that just stores the last known graphics environement in a file and execute the notification whenever it changes (execution should be instant, mostly the cost of running the jvm).

    It's not elegant, but doing something the native way would need to be cross-platform and would end up ugly too. Unless you don't care about portability.

    Choose your poison.

    0 讨论(0)
提交回复
热议问题