Respected Members, In swing if we bind some event to a component or any container for example if I want to bind an event from my JFrame tha it is necessary that the focus should be set on the JFrame while its running, if the focus is not set than the event will not be fired, is it some way that I set my JFrame as setVisible false but still programitically set the focus by setFocusable(true) or by some other means,now my frame is not visible but since focus has been set from within the program so now will the event be fired.
IF NOT than is there any way in swing that my frame is not visible on the screen but still it fires the events on some key stroke.Please give some suggestions and please help me in finding some solution.
Even if this were possible, how could events meaningfully be associated to UI elements if the user doesn't see them? Can you tell us a bit more about the underlying problem you're trying to solve?
Joined: Jun 14, 2007
Actually I want to make a program that when ever the computer starts the program also starts running at the back end in the memory like a windows service, when ever the user presses Ctrl-F3 key stroke together than a pop up message will appear on the window,if the user presses some other key stroke it would be ignored and nothing will happen,my program running in windows service would be contiously monitoring the keys,so I thought to "some how" make a JFrame and set its vasiblity to false," than "some how" bind the key press events to this JFrame,than "some how" set the focus to this frame programitically and at last "some how" get the event be fired.
I don't think your idea would work, because as soon as the user would try to do something, your JFrame would loose focus, anyway.
Speaking more generally, I don't think that what you are trying to accomplish can be done in vanilla Java.
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