aspose file tools*
The moose likes Java in General and the fly likes F1 Key not working in java HelpSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "F1 Key not working in java HelpSet" Watch "F1 Key not working in java HelpSet" New topic
Author

F1 Key not working in java HelpSet

Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

I need help in figuring out context-sensitive help(CSH).I am building a swing application which operates in two modes (Normal and Fullscreen).In that one i kept a class which handles KeyListener.

My problem is Whenever i press F1 key in Normal Window mode i can able to get CSH loaded.The same code doesn't work in Fullscreen mode.

Here is the code for the keyPressed event



Can anyone point me where i gone wrong?
Harish Kashyap
Ranch Hand

Joined: Jun 14, 2000
Posts: 118
It doesn't necessarily mean that your program has some error. As I do not see any problem with the function you have written.
Working with swings has always been tricky because they bahave differently on different platforms(OS). They inherit the native windowing capabilities from the underlying operating system.
I would suggest you to add some debug prints and firstly figure out whether this function is at all getting invoked in full screen mode?
Secondly, if your window does not gain focus, then the key press events may not get captured by your program.
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

Originally posted by Harish Kashyap:
It doesn't necessarily mean that your program has some error. As I do not see any problem with the function you have written.
Working with swings has always been tricky because they bahave differently on different platforms(OS). They inherit the native windowing capabilities from the underlying operating system.
I would suggest you to add some debug prints and firstly figure out whether this function is at all getting invoked in full screen mode?
Secondly, if your window does not gain focus, then the key press events may not get captured by your program.


Hi Harish,

I use eclipse for building my application and i inserted breakpoints inside that keyPress method and then i tried to debug it.Actually, that function gets called in both the cases(Normal and Fullscreen).But, i cannot see the help. One more thing is that i kept other shortcut keys also (like Shift+F4 which is used to toggle between Normal and Fullscreen) which are working well in Fullscreen mode.Only problem i am getting is inside this F1 key event only.
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

Here i managed to get the code working by just adding one statement to the code and my resultent code is



But now my problem is whenever i press F1 key i am getting help loaded on the screen with multiple instance(i.e.,) For every F1 key press i loads new Help frame instead of displaying already loaded frames.
Now where i have to change my code to make it appear only once.
 
Don't get me started about those stupid light bulbs.
 
subject: F1 Key not working in java HelpSet