QUESTION 5
-
An Event Handler can have only one method.
True
False
1 points
QUESTION 6
-
An inner class can have constructor(s) and instancevariables.
True
False
1 points
QUESTION 7
-
To determine an event’s source, the actionPerformed method
can call ActionEvent’s getSource method
must query its containing class
cannot determine the event source
must be created with the event source as an instancevariable
1 points
QUESTION 8
-
How many inner classes can an outer class contain?
It may contain, at most, one for each event source
An indefinite number
It must contain exactly one inner class for each eventsource
One
QUESTION 1
-
Events give us the ability to
Write programs giving the user more choices in how to interactwith the program
Read user input
Write classes with no name
Write inner classes
QUESTION 2
-
In the following program (which appears several times in thisquiz, and never changes from question to question)WVOneButtonAction.txt
What is the type of the Event Source?
1 points
QUESTION 3
-
In the following program (which appears several times in thisquiz, and never changes from question to question)WVOneButtonAction.txt
What class defines the Event Handler?
1 points
QUESTION 4
-
In the following program (which appears several times in thisquiz, and never changes from question toquestion) WVOneButtonAction.txt
What is WidgetViewerActionEvent?
An interface
A subclass
A superclass
An anonymous class
coding for number 2,3,and 4.
1 import java.awt.event.ActionEvent; 2 import javax.swing.JButton; 3 4 public class WVOneButtonAction { 5 6 private JButton jb1; 7 8 public WVOneButtonAction() { 9 WidgetViewer wv = new WidgetViewer();10 jb1 = new JButton(“0”);11 ButtonIncrementer action = new ButtonIncrementer();12 jb1.addActionListener(action);13 wv.add(jb1);14 }1516 class ButtonIncrementer extends WidgetViewerActionEvent {1718 @Override19 public void actionPerformed(ActionEvent e) {20 String bval = jb1.getText();21 int newVal = Integer.parseInt(bval) + 1;22 jb1.setText(String.valueOf(newVal));23 }2425 }2627 }
Expert Answer
Answer to QUESTION 5 An Event Handler can have only one method. True False 1 points QUESTION 6 An inner class can have constructor…