It's not a secret anymore!
The moose likes Java in General and the fly likes LIKE a screensaver?????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "LIKE a screensaver??????" Watch "LIKE a screensaver??????" New topic

LIKE a screensaver??????

Dan Temple
Ranch Hand

Joined: Jul 10, 2001
Posts: 93
Hello Everyone,
I have this really cool idea (I think) for a screensaver program. Of course I can't write it in Java since the screensaver is run by the operating system. I really want to keep the platform independence (and avoid writing native code in C++ (shudder) ). So what I want to know is, is there anyway that I can make a java program ACT like a screensaver. Specifically when it is run it sits in the background listening to keystrokes or mouse activity (even within another program) . If after a certain time there isn't any such activity then it does something until that activity occurs.
I don't think there is anyway to listen for ALL such activity (since in java one adds these listeners to a specific component) since I would need the Java program to figure out that there is no such activity going on even in any other programs. But I thought I would see if anyone has any workarounds ...
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

To me this almost seems impossible to do since like you said, events have to be registered with Java components. Still, I think nothing is impossible. If you do figure this one out, I would really like to know how to do it also.

Jack Wiesenthaler
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
It may be easier than you think. Screensavers are EXE files renamed to .SCR and started with an /s option on the command line. They usually reside in the WINDOWS directory.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
So if you had a .bat file and renamed it to .scr, and in that file you started a java application . . . .

Might be fun to play with.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: LIKE a screensaver??????
It's not a secret anymore!