I'm building a Swing GUI and each of my JFrames will have a help file associated (html) that should be opened in another JFrame when the user hits the F2 button.
Problem is I can't detect key presses from the user by adding keyListeners to my JFrames ( I added keyListeners to my JFrame, but keyPress or keyReleased events never trigger when I press the buttons), so how can I detect that the user pressed F2 on my Frame? Is the only way adding keyListeners to every single component inside of it? Do I need to have another thread in each JFrame wich is sole purpose would be listening for this kind of events?
Or is there any nicer way to do it?
TIA
Problem is I can't detect key presses from the user by adding keyListeners to my JFrames ( I added keyListeners to my JFrame, but keyPress or keyReleased events never trigger when I press the buttons), so how can I detect that the user pressed F2 on my Frame? Is the only way adding keyListeners to every single component inside of it? Do I need to have another thread in each JFrame wich is sole purpose would be listening for this kind of events?
Or is there any nicer way to do it?
TIA