Exam 10: Graphical User Interfaces
Exam 1: Introduction96 Questions
Exam 2: Fundamental Data Types103 Questions
Exam 3: Decisionseasy99 Questions
Exam 4: Loops100 Questions
Exam 5: Methods94 Questions
Exam 6: Arrays and Arraylists100 Questions
Exam 7: Inputoutput and Exception Handling100 Questions
Exam 8: Objects and Classes101 Questions
Exam 9: Inheritance and Interfaces99 Questions
Exam 10: Graphical User Interfaces54 Questions
Exam 11: Advanced User Interfaces91 Questions
Exam 12: Object-Oriented Design100 Questions
Exam 13: Recursion100 Questions
Exam 14: Sorting and Searching99 Questions
Exam 15: The Java Collections Framework100 Questions
Exam 16: Basic Data Structures94 Questions
Exam 17: Tree Structures100 Questions
Exam 18: Generic Classes78 Questions
Exam 19: Streams and Binary Inputoutput82 Questions
Exam 20: Multithreading82 Questions
Exam 21: Internet Networking74 Questions
Exam 22: Relational Databases75 Questions
Exam 23: XML74 Questions
Exam 24: Web Applications74 Questions
Select questions type
If a text field holds an integer, what expression do you use to read its contents?
Free
(Multiple Choice)
4.8/5
(31)
Correct Answer:
C
When a component is added to a container, what does the exact location and size of the component depend on?
Free
(Multiple Choice)
4.9/5
(34)
Correct Answer:
A
To respond to a button event, a listener must supply instructions for the ____ method of the ActionListener interface.
Free
(Multiple Choice)
4.8/5
(38)
Correct Answer:
B
Consider the following code snippet:
Import ____________________
Import java.awt.event.ActionListener;
/**
An action listener that prints.
*/
Public class ClickListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.out.println("I was clicked.");
}
}
Which of the following statements will complete this code?
(Multiple Choice)
4.7/5
(41)
Consider the following code snippet:
Public class ClickListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.out.println("I was clicked.");
}
}
Public class ButtonTester
{
Public static void main(String[] args)
{
JFrame frame = new JFrame();
JButton button = new JButton("Click me!");
Frame.add(button);
ActionListener listener = new ClickListener();
Button.addActionListener(listener);
)..
}
}
Which of the following statements is correct?
(Multiple Choice)
4.7/5
(44)
When drawing complex shapes, make a separate class for each part and provide a(n) ___ method that draws the shape.
(Multiple Choice)
4.8/5
(31)
Based on the following statement, which of the following statements sets the title of the frame:
JFrame frame = new JFrame();
(Multiple Choice)
4.8/5
(31)
The methods of a/an ____ describe the actions to be taken when an event occurs.
(Multiple Choice)
4.8/5
(40)
Which of the following statements creates a button with "Calculate" as its label?
(Multiple Choice)
4.9/5
(41)
Which statements will create an editable text field and assign "Your choice" to it?
(Multiple Choice)
4.7/5
(40)
When an event occurs, the event source notifies all associated ____.
(Multiple Choice)
4.8/5
(45)
Which of the following statements about listener classes is true?
(Multiple Choice)
4.9/5
(34)
Insert the missing statement(s) in the following code fragment. The code is intended to display a message "Your cost is: " in a text area and display the cost on the next line.
Double cost = 500.99;
String message = "Your cost is:";
JTextArea result = new JTextArea(10, 30);
__________________________________________
Result.setEditable(false);
(Multiple Choice)
4.9/5
(41)
Consider the following code snippet that is supposed to show the total order amount when the button is clicked:
Public static void main(String[] args)
{
Final Order myOrder = new Order();
JButton button = new JButton("Calculate");
Final JLabel label = new JLabel("Total amount due");
) . .
Class MyListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
Label.setText("Total amount due " + myOrder.getAmountDue());
}
}
ActionListener listener = new MyListener();
}
What is wrong with this code?
(Multiple Choice)
4.9/5
(38)
An inner class can access local variables from the enclosing method only if they are declared as ____.
(Multiple Choice)
4.9/5
(42)
How do you specify what the program should do when the user clicks a button?
(Multiple Choice)
4.8/5
(35)
Which statement will add a dollar sign and the value of the double variable balance to a JTextArea component called results?
(Multiple Choice)
4.7/5
(41)
A/an ____ object contains methods that describe the actions to be taken when a user clicks a user-interface graphical object.
(Multiple Choice)
4.9/5
(41)
An event listener for a button must implement the ____ interface.
(Multiple Choice)
5.0/5
(42)
The ____ method should be called whenever you modify the shapes that the paintComponent method draws.
(Multiple Choice)
4.8/5
(32)
Showing 1 - 20 of 54
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)