Multiple Choice
If the makeMenuItem method is called four times, at most how many different actions can be performed by these four newly created MenuItem objects when the doSomethingElse method is called?
public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel) ;
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomethingElse(e) ;
}
}
mi.addActionListener(new MyMenuListener() ) ;
return mi;
}
A) 1
B) 2
C) 3
D) 4
Correct Answer:

Verified
Correct Answer:
Verified
Q8: When adding a component to a container
Q9: What can you add action listeners to?<br>A)Menu
Q10: Which of the following would be an
Q11: Insert the missing code in the following
Q12: Which of the following methods returns the
Q14: What is the most time-effective way to
Q15: If a JPanel with a BorderLayout manager
Q16: Which layout manager allows you to add
Q17: What is the default layout manager of
Q18: When method makeMenuItem is called, how many