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