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
import javax.swing.*;
public class JFrameLabel
{
public static void main(String[] args)
{
final int FRAME_WIDTH = 300;
final int FRAME_HEIGHT = 120;
JFrame myFrame = new JFrame("Frame with label");
myFrame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
myFrame.setVisible(true);
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
_________________________
_________________________
}
}
The above code shows an application in which a JFrame is created and its size, visibility, and close operation are set. In the blank lines provided, write the code to create a JLabel named thanks that holds the words "Thank you for your business". Then, write the statement to add the JLabel to the JFrame.
(Essay)
4.9/5
(39)
Within an event-driven program, a component on which an event is generated is the ____ of the event.
(Multiple Choice)
4.9/5
(39)
Write the statement to create a JButton named submitButton with the label "Submit your data".
(Essay)
4.8/5
(28)
A(n) ____________________ is the default appearance and behavior of any user interface.
(Short Answer)
4.9/5
(35)
Write the statement to add a tool tip that displays "Submit your form" to a button named submit.
(Essay)
4.9/5
(32)
import javax.swing.*;
import java.awt.*;
public class JFrame4
{
public static void main(String[] args)
{
final int FRAME_WIDTH = 250;
final int FRAME_HEIGHT = 100;
________________________
JFrame aFrame = new JFrame("Fourth frame");
aFrame.setSize(FRAME_WIDTH, FRAME_HEIGHT); aFrame.setVisible(true);
aFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel greeting = new JLabel("Good day");
________________________
aFrame.add(greeting);
}
}
In the first blank line provided, write the statement to create a Font object named myLook with a typeface of Times New Roman, italic, and 30-point size. In the second blank line, create the statement to apply myLook to the greeting JLabel.
(Essay)
4.8/5
(32)
Match each term with the correct statement below.
-Are written completely in Java and do not have to rely on the local operating system code
(Multiple Choice)
4.7/5
(31)
Match each term with the correct statement below.
-The measurement between lines of text in a single-spaced text document
(Multiple Choice)
5.0/5
(40)
When a user closes a JFrame by clicking the Close button in the upper-right corner, the default behavior is for the JFrame to close and the application to terminate.
(True/False)
4.9/5
(42)
import javax.swing.*;
public class JFrame1
{
public static void main(String[] args)
{
JFrame aFrame = new JFrame("First frame");
aFrame.setSize(300, 125);
aFrame.setVisible(true);
}
}
The three shaded statements in the main() method above are important. Explain the purpose of each statement and why they are necessary for creating a JFrame.
(Essay)
4.8/5
(42)
Match each term with the correct statement below.
-Arial, Century, Monospaced, and Times New Roman
(Multiple Choice)
4.8/5
(33)
Create the statements to construct two JFrames. One JFrame should be declared as welcomeFrame and have the title "Welcome", and the second JFrame should be declared as noTitleFrame and have no title.
(Essay)
4.8/5
(43)
You can use the setEnabled() method to make a component unavailable and then make it available again in turn.
(True/False)
4.9/5
(41)
Showing 41 - 60 of 74
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)