I need a help regarding detection of Resolution Change in system using java.I already have a piece of working code to bring up my frame which contains lot of components included in it. Now i need to include one more module which detects for resolution change under my windows machine.
I got one idea but i don't know whether that one is well suited for this scenario. I just thought of writing a separate timer thread which detect system resolution(every second) and react accordingly.
Is there any other way we can detect System Resolution change under Java???
Are there any event handlers in java for handling this scenario???
Originally posted by Gavin Tranter: I think you might have to write a JNI interface into windows land, and have a native module listern for resolution chnage messages.
Thanks Gavin Tranter,for your input.Instead of writing a separate JNI interface i thought of making it work like this
I have written a separate timer thread that detects System Resolution and performs some task. I can start that timer thread once my application lost focus and stop the thread once my application gain focus.
Is this solution will result in any problem in future??? else i really need to switch over to JNI interface [ June 17, 2008: Message edited by: Balasubramanian Chandrasekaran ]
Unless there are classes in the java 2D package that can detect the current resolution, i dont see how this can be done without JNI.
I think either way you will end up with a thread that periodically detects the resolution change. I would set it up to be a very lightweight thread that fires an event that the main app can listern for.
Is a reason that you need to check for a resolution change? I would have thought that resolutions are generally static on a given machine, I know the only time I change mine is when a game automatically changes it or a get a better graphics card/monitor.
This won't work correctly on systems with multiple screens when your application is being displayed on a different than the primary screen. You'd better ask your components for their toolkits.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus