As internal classes.
Why? Classes are cheap and easier.
Type: Posts; User: Norm
As internal classes.
Why? Classes are cheap and easier.
Not necessarily. You can use if statements to chose which action listener to add.
if(cond1)
add listener 1
if(cond2)
add listener 2
etc
I don't know how you can get the right listener code...
call the item's addActionListener() method with a reference to an ActionListener object.
Is the question: How to have useful code in the listener that is related to the menu items. How does the...
Can you explain? What does "manage an ActionListener" mean?
When a listener is added to a menu item, pass its constructor all the data it needs.
Is this the approch that you are asking about:
read the data
use the data to control the building of the menu items.
Instead of sequential statements, use if statements to control how the menu...
Everything a program does is done at runtime.
One question might be: what is the source of the Strings used in the menu items: literals coded in the program vs Strings read in from a file.