Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

F1 Key not working in java HelpSet

 
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 215
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 215
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic