Exam 12: A First Look at GUI Applications
Exam 1: Introduction to Computers and Java51 Questions
Exam 2: Java Fundamentals61 Questions
Exam 3: Decision Structures64 Questions
Exam 4: Loops and Files57 Questions
Exam 5: Methods60 Questions
Exam 6: A First Look at Classes58 Questions
Exam 7: Arrays and the Arraylist Class64 Questions
Exam 8: A Second Look at Classes and Objects50 Questions
Exam 9: Text Processing and More About Wrapper Classes60 Questions
Exam 10: Inheritance70 Questions
Exam 11: Exceptions and Advanced File IO56 Questions
Exam 12: A First Look at GUI Applications60 Questions
Exam 13: Advanced GUI Applications58 Questions
Exam 14: Applets and More54 Questions
Exam 15: Creating GUI Applications With Javafx and Scene Builder40 Questions
Exam 16: Recursion42 Questions
Exam 17: Databases48 Questions
Select questions type
The variable panel references a JPanel object. The variable bGroup references a ButtonGroup object, which contains several button components. If you want to add the buttons to the panel:
Free
(Multiple Choice)
4.8/5
(30)
Correct Answer:
D
This layout manager arranges components in regions named North, South, East, West, and Center.
Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
B
To end an application, pass this as the argument to the JFrame class's setDefaultCloseOperation() method.
Free
(Multiple Choice)
4.8/5
(45)
Correct Answer:
C
The minimize button, maximize button, and close button on a window are sometimes referred to as:
(Multiple Choice)
5.0/5
(36)
To use the Color class, which is used to set the foreground and background of various objects, use the following import statement:
(Multiple Choice)
4.8/5
(41)
What will be the result of executing the following statement?
Panel.setBorder(BorderFactory.createLineBorder(Color.BLUE, 5));
(Multiple Choice)
4.8/5
(40)
You would use this command at the operating system command line to execute the code in the MyApplication class and display the graphic image Logo·jpg as a splash screen.
(Multiple Choice)
4.8/5
(39)
A GUI program automatically stops executing when the end of the main method is reached.
(True/False)
4.9/5
(34)
A common technique for writing an event listener class is to write it as a private inner class inside the class that creates the GUI.
(True/False)
4.8/5
(36)
These components have a consistent look and predictable behavior on any operating system.
(Multiple Choice)
4.9/5
(38)
You use the ________ key word in a class header to indicate that it implements an interface.
(Multiple Choice)
4.8/5
(46)
Why doesn't the following code compile correctly?
Import java.awt.*;
Import java.awt.event.*;
Import javax.swing.*;
Public class ColorCheckBoxWindow extends JFrame
{
Private JCheckBox greenCheckBox;
Private final int WINDOW_WIDTH = 300, WINDOW_HEIGHT = 100;
Public ColorCheckBoxWindow()
{
SetTitle("Green Check Box");
SetSize(WINDOW_WIDTH, WINDOW_HEIGHT);
SetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GreenCheckBox = new JCheckBox("Green");
GreenCheckBox.addItemListener(new CheckBoxListener());
SetLayout(new FlowLayout());
Add(greenCheckBox);
SetVisible(true);
}
Public void itemStateChanged(ItemEvent e)
{
If (e.getSource() == greenCheckBox)
{
System.exit(0);
}
}
}
(Multiple Choice)
4.9/5
(40)
Check boxes may be grouped in a ButtonGroup, like radio buttons are.
(True/False)
4.8/5
(44)
What will be the result of executing the following statement?
Panel.setBorder(BorderFactory.createTitleBorder("Title"));
(Multiple Choice)
4.9/5
(42)
How many radio buttons can be selected at the same time as the result of the following code?
Hours = new JRadioButton("Hours");
Minutes = new JRadioButton("Minutes");
Seconds = new JRadioButton("Seconds");
Days = new JRadioButton("Days");
Months = new JRadioButton("Months");
Years = new JRadioButton("Years");
TimeOfDayButtonGroup = new ButtonGroup();
DateButtonGroup = new ButtonGroup();
TimeOfDayButtonGroup.add(hours);
TimeOfDayButtonGroup.add(minutes);
TimeOfDayButtonGroup.add(seconds);
DateButtonGroup.add(days);
DateButtonGroup.add(months);
DateButtonGroup.add(years);
(Multiple Choice)
4.8/5
(40)
When an application uses many components, rather than deriving just one class from the JFrame class, it is often better to encapsulate smaller groups of related components and their event listeners into their own class. A commonly used technique to do this is:
(Multiple Choice)
4.8/5
(37)
Showing 1 - 20 of 60
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)