Buddhism Flashcards
If panel references a JPanel object, which of the following statements adds the GridLayout to it?
A. panel.setLayout(new GridLayout(2, 3));
B. panel.addLayout(new GridLayout(2, 3));
C. panel.GridLayout(2, 3);
D. panel.attachLayout (GridLayout(2, 3));
A. panel.setLayout(new GridLayout(2, 3));
What will be the result of executing the following statement?
panel.setBorder (BorderFactory.createLineBorder (Color.BLUE, 5));
A. The JPanel referenced by panel will have a blue line border that is 5 millimeters thick
B. The JPanel referenced by panel will have a blue line border that is 5 pixels thick
C. The JPanel referenced by panel will have a blue line border that is 5 characters thick
D. The JPanel referenced by panel will have a blue line border that is 5 inches thick
B. The JPanel referenced by panel will have a blue line border that is 5 pixels thick
When adding components to a container that is governed by the GridLayout manager:
A. You cannot specify a cell
B. You specify the cell with the row and column numbers in the add statement
C. You must add them starting with the lower, right cell
D. The components are added automatically by filling up the first column, then the second, etc.
A. You cannot specify a cell
To end an application, pass this as the argument to the JFrame class’s
setDefaultCloseOperation() method.
A. END_ON_CLOSE
B. JFrame.END_ON_CLOSE
C. JFrame.EXIT_ON_CLOSE
D. JFrame.CLOSE_NOT_HIDE
C. JFrame.EXIT_ON_CLOSE
When using the BorderLayout manager, how many components can each region hold?
A. 1
B. 2
C. 5
D. No limit
A. 1
To use the ActionListener interface, as well as other event listener interfaces, you must have the following import statement in your code:
A. import java.swing;
B. import java.awt;
C. import java.awt.;
D. import java.awt.event.;
D. import java.awt.event.*;
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:
A. use the statement, panel.add(bGroup);
B. use the statement, bGroup.add(panel);
C. use the statement, Panel panel = new Panel(bGroup);
D. add each button to panel one at a time, e.g. panel.add(button1);
D. add each button to panel one at a time, e.g. panel.add(button1);
Which of the following is not a class used in constructing a menu system?
A. JMenuItem
B. JCheckBoxMenuItem
C. JButton
D. JRadioButtonMenuItem
C. JButton
In a Swing application, you create a frame object from the:
A. JLabel class
B. JFrame class
C. JPanel class
D. AbstractButton class
B. JFrame class
If button1 is a JButton object, which of the following statements will make its background blue?
A. button1.makeBackground(BLUE); B. button1.setBackground (Color.BLUE);
C. button1.makeBackground (Color.BLUE);
D. button1.set.Background(BLUE);
B. button1.setBackground (Color.BLUE);
To use the ActionListener interface, as well as other event listener interfaces, you must have the following import statement in your code:
A. import java.swing;
B. import java.awt;
C. import java.awt.;
D. import java.awt.event.;
D. import java.awt.event.*;
Layout manager arranges components in regions named North, South, East, West, and Center.
A. GridLayout
B. BorderLayout
C. FlowLayout
D. RegionLayout
B. BorderLayout
Swing components are?
lightweight.
AWT components are?
heavyweight
a set of GUI components which simplify the development of desktop applications.
Java Foundation Classes (JFC)
JFC stands for?
Java Foundation Classes
AWT components are __________ - _____________?
platform-dependent.
Java swing components are __________ - _____________?
platform-independent.
___________ is a library of classes that do not replace ____________, but provide an improved alternative for creating GUI applications.
Swing, AWT
The minimize button, maximize button, and close button on a window are sometimes referred to as:
decorations
Which one of the following GUI components is considered to be a container?
Frame
these components rely on the appearance and behavior of the underlying operating system components, there is little that can be done by the programmer to change their properties.
AWT
One of the small dots that make up a screen display is known as what?
pixel
In Swing, labels are created with this class:
JLabel
To use the ActionListener interface, as well as other event listener interfaces, you must have the following import statement in your code:
import java.awt.event.*;
When you write an action listener class for a JButton component, it must:
- implement the ActionListener interface
- have a method named actionPerformed which must take an argument of the ActionEvent type
a Swing application, you create a frame object from the
JFrame class
To use the Color class, which is used to set the foreground and background of various objects, use the following import statement:
import java.awt.*;
This layout manager arranges components in rows.
FlowLayout
This is commonly used to hold and organize collections of related components
panel
To include Swing and AWT components in your program, use the following import statements:
import javax.swing;
import java.awt;
AWT components are commonly called ____________ components because they are coupled with their underlying peer classes.
Heavyweight
Which of the following statements creates a class that is extended from the JFrame class?
public class DerivedClass extends JFrame{}
This layout manager arranges components in five regions.
BorderLayout
What will be the result of executing the following statement?
panel.setBorder(BorderFactory.createTitleBorder(“Title”));
The JPanel referenced by panel will have an etched border with the title “Title” displayed on it.
Event listeners must:
implement an interface
This is a basic window that has a border around it, a title bar, and a set of buttons for minimizing, maximizing, and closing the window.
Frame
The default selection mode for a JList component is:
multiple interval selection
What will be the results of executing the following statements?
x.setEditable(true);
x.setText(“Tiny Tim”);
The text field x will have the value “Tiny Tim” and the user will be able to change its value.
This type of combo box combines a button with a list and allows the user to select items from its list only.
Uneditable
class is used to arrange the components in a rectangular grid. One component is displayed in each rectangle.
GridLayout