Exam 14: Introduction to Swing Components
Exam 1: Creating Java Programs68 Questions
Exam 2: Using Data74 Questions
Exam 3: Using Methods, Classes, and Objects68 Questions
Exam 4: More Object Concepts67 Questions
Exam 5: Making Decisions70 Questions
Exam 6: Looping72 Questions
Exam 7: Characters, Strings, and the Stringbuilder73 Questions
Exam 8: Arrays74 Questions
Exam 9: Advanced Array Concepts74 Questions
Exam 10: Introduction to Inheritance70 Questions
Exam 11: Advanced Inheritance Concepts70 Questions
Exam 12: Exception Handling65 Questions
Exam 13: File Input and Output74 Questions
Exam 14: Introduction to Swing Components74 Questions
Exam 15: Advanced Gui Topics69 Questions
Exam 16: Graphics74 Questions
Exam 17: Applets, Images, and Sound72 Questions
Select questions type
Which of the following statements will correctly set a JFrame named myFrame to be visible?
Free
(Multiple Choice)
4.9/5
(40)
Correct Answer:
B
The ____ method of JComboBox returns the maximum number of items the combo box can display without a scroll bar.
Free
(Multiple Choice)
4.7/5
(30)
Correct Answer:
C
Assume you have declared a JFrame named welcomeFrame. Write the statement to set the welcomeFrame object's size to 300 pixels horizontally by 110 pixels vertically. Create a second statement to set the JFrame's title to display the text "My Sized Frame".
Free
(Essay)
4.9/5
(38)
Correct Answer:
welcomeFrame.setSize(300, 110);
welcomeFrame.setTitle("My Sized Frame");
A ____ is a component that combines two features: a display area showing an option, and a list box containing additional options.
(Multiple Choice)
4.8/5
(39)
Java provides you with a Font class from which you can create an object that holds typeface and size information.
(True/False)
4.9/5
(45)
Match each term with the correct statement below.
-A class that controls component positioning
(Multiple Choice)
4.9/5
(28)
A component can be made available or unavailable by passing true or false to the ____ method.
(Multiple Choice)
4.7/5
(32)
Match each term with the correct statement below.
-A JTextField that has the capability of accepting keystrokes
(Multiple Choice)
4.7/5
(37)
The default behavior of a JFrame is to use the BorderLayout format, which divides a container into regions.
(True/False)
4.8/5
(35)
If a user enters more characters than specified in a JTextField, the extra characters scroll out of view.
(True/False)
4.8/5
(36)
When a JFrame is closed, you can end a program that you have forgotten to exit by typing Ctrl+E.
(True/False)
4.9/5
(39)
Match each term with the correct statement below.
-A method that executes because it is called automatically when an appropriate event occurs
(Multiple Choice)
4.8/5
(34)
The JLabel constructor ____ creates a JLabel instance with the specified image and horizontal alignment.
(Multiple Choice)
4.8/5
(36)
The Swing classes are part of a more general set of UI programming capabilities that are collectively called the ____.
(Multiple Choice)
4.7/5
(30)
import javax.swing.*;
import java.awt.*;
public class JFrame6
{
public static void main(String[] args)
{
final int FRAME_WIDTH = 250;
final int FRAME_HEIGHT = 100;
JFrame aFrame = new JFrame("Sixth frame");
aFrame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
aFrame.setVisible(true);
aFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel greeting = new JLabel("Hello");
JLabel greeting2 = new JLabel("Who are you?");
_________________________
aFrame.add(greeting);
aFrame.add(greeting2);
}
}
Using the above code, write the FlowLayout statement in the blank line provided that will display the two greeting JLabels side by side.
(Essay)
4.8/5
(39)
Showing 1 - 20 of 74
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)