This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Respected Members, I am making a very simple program in Java swing using jdk1.4.2, the program simply contains a JFrame and nothing else,what it is simply doing that I have binded an event to this frame and which is that every time the user presses Ctrl-F3(control and F3 key) so a message is displayed stating for example that "you pressed right key", but my program is not working, the probelm is that the event dont get fired,if I test it indivisually for Ctrl or F3 than the event is fiered and every thing works fine, teh code is:
Every time a key is pressed a key pressed event is thrown. This means that you will actually receive an event for the F3 key AND another event for the Ctrl key.
What you want to do is remember that you pressed the "Ctrl" key and remember that you pressed the "F3" key. And test on that when the other key is pressed. When the key released event comes you must remove the pressed keys from your memory.
I don't know if this is clear enough for you. I will give a short example:
Step 1: Key pressed Event for the Ctrl key --> you store the key (or set a boolean or ...) Step 2: Key pressed Event for the F3 key --> you check the previously pressed key (check the boolean or ...) Step 3: Key released Event for the Ctrl key --> now you switch back your boolean (the key is no longer pressed)