Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java detect when user closes down the laptop screen?

Tags:

java

swing

I have a little program where i need to somehow detect when the user just closes down his/her laptop screen. So; not turning of the entire computer but rather just closing down the screen.

Ive got a chat program and i need to make the user go offline when the screen is closed. For some reason my current socket connection is still alive when i just close down the screen.

Any ideas?

like image 325
Alosyius Avatar asked Jul 12 '26 16:07

Alosyius


1 Answers

You can give a look to that library :

http://www.codeproject.com/Articles/6590/PC-StandBy-Detector-for-Java-Apps

It is really simple to use and worked well for me. (Window only)

like image 133
SegFault Avatar answered Jul 15 '26 05:07

SegFault



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!