Re: how to write this simple program?
On 3/29/2015 4:11 PM, John wrote:
Hi:
I want to write a simple program: when it is running, it flashes a sentence on the computer screen for 300 milliseconds(300 can be adjusted), then disappear. After 10 seconds(also can be adjusted), it flashes again. It keeps doing this, until the user pause or exit the program.
There is no any frames to be shown. Only a few words are shown on the desktop screen quickly, then disappear. I don't want to see a rectangle surrounding the words. If the user is using a program, like browsing the internet, the words are still shown on the top of the application he is using.
Not sure Java GUI can do this. If not, what other programming language can do it? C programming language? It's intended to be used on Microsoft Windows.
Java can do it, pretty much. Build a JFrame containing what you
want to display, and before displaying it use setUndecorated(true) and
probably setAlwaysOnTop(true). Then use a javax.swing.Timer object to
make the JFrame visible/invisible at scheduled moments (you could do it
with a java.util.Timer, too, but the Swing timer is probably simpler).
The "pretty much" part is that the method I've described will also
put an icon in the taskbar (if there's a way to avoid this, I don't know
it), so your "only a few words" requirement is not satisfied perfectly.
On the other hand, you imply that the user should be able to "pause or
exit the program," which suggests he needs *some* way to communicate
with it; a taskbar icon might be just what's needed.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM