Exam 20: Graphical User Interfaces
Exam 1: Introduction76 Questions
Exam 2: Using Objects82 Questions
Exam 3: Implementing Classes108 Questions
Exam 4: Fundamental Data Types124 Questions
Exam 5: Decisions119 Questions
Exam 6: Loops107 Questions
Exam 7: Arrays and Array Lists117 Questions
Exam 8: Designing Classes88 Questions
Exam 9: Inheritance99 Questions
Exam 10: Interfaces100 Questions
Exam 11: Input/Output and Exception Handling108 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion99 Questions
Exam 14: Sorting and Searching100 Questions
Exam 15: The Java Collections Framework102 Questions
Exam 16: Basic Data Structures102 Questions
Exam 17: Tree Structures102 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Stream Processing85 Questions
Exam 20: Graphical User Interfaces75 Questions
Exam 21: Advanced Input/Output90 Questions
Exam 22: Multithreading81 Questions
Exam 23: Internet Networking74 Questions
Exam 24: Relational Databases75 Questions
Exam 25: XML74 Questions
Select questions type
Examine the code below.What type of class is MyMenuListener?
public JMenuItem makeMenuItem(String menuLabel)
{
JMenuItem mini = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomething();
}
}
mini.addActionListener(new MyMenuListener());
return mi;
}
(Multiple Choice)
4.7/5
(40)
What is known for certain from this correct code excerpt?
ActionListener openListener = new FileOpenListener();
JMenuItem fileOpen = new JMenuItem("Open File");
fileOpen.addActionListener(openListener);
(Multiple Choice)
4.8/5
(35)
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;
}
(Multiple Choice)
4.8/5
(38)
When a menu item is selected, what type of event does it send?
(Multiple Choice)
4.8/5
(35)
Which method can a program use to set the selected choice in a JComboBox?
(Multiple Choice)
4.9/5
(40)
The JFrame has a content pane with a default BorderLayout manager.Which method allows changing it to a FlowLayout manager?
(Multiple Choice)
4.8/5
(36)
The statement that would add smallButton to the button group in the following code is _________.
JRadioButton smallButton = new JRadioButton("Small");
ButtonGroup group = new ButtonGroup();
(Multiple Choice)
4.8/5
(36)
When using a combo box, the _______ displays the name of the current selection.
(Multiple Choice)
4.8/5
(40)
Consider the scope of the three objects menuLabel, mi, and the anonymous object new MyMenuListener() within the JmenuItem class.How do thier lifetimes compare?
public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel);
class MyMenuListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doSomethingElse();
System.out.println(menuLabel);
}
}
mi.addActionListener(new MyMenuListener());
return mi;
}
(Multiple Choice)
5.0/5
(36)
Given four JRadioButton objects in a ButtonGroup, how many radio buttons can be selected at the same time?
(Multiple Choice)
4.7/5
(40)
What type does the method getSelectedItem in the JComboBox classreturn?
(Multiple Choice)
4.9/5
(34)
Showing 61 - 75 of 75
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)