• 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 question

 
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
 
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.
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • 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
 
Yes, my master! Here is the tiny ad you asked for:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic