Detect screen resolution change made by user (Java Listener?)

后端 未结 5 1159
失恋的感觉
失恋的感觉 2021-01-17 19:17

I have a Java app that launches, creates a GUI and works great. If the user changes the screen resolution (switches from 1440x900 to 1280x768), I\'d like to be able to list

5条回答
  •  旧时难觅i
    2021-01-17 19:57

    Here is my suggestion for this problem,

    1. Every swing object can implement an interface called java.awt.event.ComponentListener.
    2. One of its method is componentResized(ComponentEvent e).
    3. Your main application frame should implement this interface and override the resize event method. This is how you listen to the resize event, Checkout this link . I hope this helps you.

提交回复
热议问题