• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

F1 question

 
Bodenstab Oliver
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a dialog for the connection properties. My problem is, that I want to support the F1 Key. Do I have to implement to all components an actionMap
like


or there a better way

Thanks for replies
Oliver
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't pretend to know the answer, but perhaps it is better to post a question like this in our Swing/AWT forum.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Oliver,

From the code snippet, it appears that you have a dedicated Help button. In which case, why wouldnt you only assign the help Action to that one button? Why do you think you might need to add it to all the components?

Some random thoughts (untested):

Alternatively, if you removed the help button, you could assign this Action to any component - as long as a component reacts to the F1 action, you should be able to get your online help. (Doing this is non-intuitive though, both for the user and for the reader of the code, so you would have to really decide whether it is worthwhile or not).

Another alternative (but getting way beyond the assignment requirements) might be to assign the help action to all the components, which might give you context specific help.

Originally posted by Barry Gaunt:
perhaps it is better to post a question like this in our Swing/AWT forum
If you would like me to move this question to that forum, just say so.

Regards, Andrew
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oliver, on re-reading my previous post, I realised that it could be misinterpreted.
I did not mean that such a topic is unwelcome, I meant to point out that for technical issues such as function key handling expert help is available in the Swing forum if you need it.

-Barry
 
Bodenstab Oliver
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all,

my comment is a little bit late, because I was out of order.

I solve the proble by the following code


The main think was the getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
This statement works on all widgets. Because my Dialog has no menu bar,
but the F1 key should work on all widgets, I need this functionalaty.

Thanks again.

Oliver
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic