Thanks for the answer. I may come off as an idiot but it all got foggy for me ever since i started learning about methods that are being called automatically and we don't need to call them ( like Paint ). I kind of got the big picture of it but it would be great if you could guide me by answering this questions:
1. Basically the if statements tests and the code being ran if the
test is true are all equivalent to the addAction method ( in a way ), right ?
2. What does the timer do, check every 'delay' miliseconds if we pressed anything? Why does it start again when we passed the test for pressing a button and why does it stop when you aren't pressing any?
3. I have problems understanding completely the functionality of this piece of code ( a huge composite question ):
What is the Action's name ? super(name) makes an action with the parameter being name and that is the one we use ? What is 'this' action in the actionMap? Does 'this' go into the actionPerformed below ?
Is component.getActionMap().put a way of specifically attributing actions for a component? Same like component.addActionListener(this) ?
Also those lines:
I get the first 2 lines (from a syntax point of view ) but why and where are we using it ( i am referring now to releasedKeyStroke )? Follow up question to that, when are we ( if ever) using the input from inputMap.put(releasedKeyStroke, getValue(Action.NAME)); ? We use it to trigger going into the ActionPerformed a last time when we release a button to eventually listen to keys ?
5. When do we call KeyBoardNavigation's ActionPerformed ? Or what is the line of code that triggers it to it. Whenever a NavigationAction is triggered, also a KeyBoardNavigation action is triggered?
If you could answer those questions it would be great and it would help me a lot. This reply helped me a lot aswell because as i was writing i started to understand the whole concept better.
Thanks a ton and have a great weekend !