Buddhism Flashcards

1
Q

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

A. panel.setLayout(new GridLayout(2, 3));

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

B. The JPanel referenced by panel will have a blue line border that is 5 pixels thick

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A. You cannot specify a cell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

C. JFrame.EXIT_ON_CLOSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When using the BorderLayout manager, how many components can each region hold?

A. 1
B. 2
C. 5
D. No limit

A

A. 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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.
;

A

D. import java.awt.event.*;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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);

A

D. add each button to panel one at a time, e.g. panel.add(button1);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following is not a class used in constructing a menu system?

A. JMenuItem
B. JCheckBoxMenuItem
C. JButton
D. JRadioButtonMenuItem

A

C. JButton

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In a Swing application, you create a frame object from the:

A. JLabel class
B. JFrame class
C. JPanel class
D. AbstractButton class

A

B. JFrame class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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);

A

B. button1.setBackground (Color.BLUE);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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.
;

A

D. import java.awt.event.*;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Layout manager arranges components in regions named North, South, East, West, and Center.

A. GridLayout
B. BorderLayout
C. FlowLayout
D. RegionLayout

A

B. BorderLayout

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Swing components are?

A

lightweight.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

AWT components are?

A

heavyweight

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

a set of GUI components which simplify the development of desktop applications.

A

Java Foundation Classes (JFC)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

JFC stands for?

A

Java Foundation Classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

AWT components are __________ - _____________?

A

platform-dependent.

18
Q

Java swing components are __________ - _____________?

A

platform-independent.

19
Q

___________ is a library of classes that do not replace ____________, but provide an improved alternative for creating GUI applications.

A

Swing, AWT

20
Q

The minimize button, maximize button, and close button on a window are sometimes referred to as:

A

decorations

21
Q

Which one of the following GUI components is considered to be a container?

A

Frame

22
Q

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.

A

AWT

23
Q

One of the small dots that make up a screen display is known as what?

A

pixel

24
Q

In Swing, labels are created with this class:

A

JLabel

25
Q

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.awt.event.*;

26
Q

When you write an action listener class for a JButton component, it must:

A
  • implement the ActionListener interface
  • have a method named actionPerformed which must take an argument of the ActionEvent type
27
Q

a Swing application, you create a frame object from the

A

JFrame class

28
Q

To use the Color class, which is used to set the foreground and background of various objects, use the following import statement:

A

import java.awt.*;

29
Q

This layout manager arranges components in rows.

A

FlowLayout

30
Q

This is commonly used to hold and organize collections of related components

A

panel

31
Q

To include Swing and AWT components in your program, use the following import statements:

A

import javax.swing;
import java.awt;

32
Q

AWT components are commonly called ____________ components because they are coupled with their underlying peer classes.

A

Heavyweight

33
Q

Which of the following statements creates a class that is extended from the JFrame class?

A

public class DerivedClass extends JFrame{}

34
Q

This layout manager arranges components in five regions.

A

BorderLayout

35
Q

What will be the result of executing the following statement?

panel.setBorder(BorderFactory.createTitleBorder(“Title”));

A

The JPanel referenced by panel will have an etched border with the title “Title” displayed on it.

36
Q

Event listeners must:

A

implement an interface

37
Q

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.

A

Frame

38
Q

The default selection mode for a JList component is:

A

multiple interval selection

39
Q

What will be the results of executing the following statements?

x.setEditable(true);
x.setText(“Tiny Tim”);

A

The text field x will have the value “Tiny Tim” and the user will be able to change its value.

40
Q

This type of combo box combines a button with a list and allows the user to select items from its list only.

A

Uneditable

41
Q

class is used to arrange the components in a rectangular grid. One component is displayed in each rectangle.

A

GridLayout