If the method makeMenuItem is called four times, how many MyMenuListener objects will be created?
public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel) ;
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomething() ;
}
}
mi.addActionListener(new MyMenuListener() ) ;
return mi;
}
A) 1
B) 2
C) 3
D) 4
Correct Answer:
Verified
Q39: What type does the method getSelectedItem in
Q40: Which method can a program use to
Q41: What is known for certain from this
Q42: What is wrong with the following code?
class
Q43: What features do GUI builders have to
Q45: Which elements of creating a graphical user
Q46: You can add a(n) _ to a
Q47: Which of the following generate action events?
A)Buttons
B)Menu
Q48: What is the most time-effective way to
Q49: If the makeMenuItem method is called four
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents