Chapter 14 Flashcards

1
Q

A JFrame is a descendent of

A

Component, container, and window classes

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

Unlike a window, a JFrame

A

Has a title bar and border

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

The statement JFrmae myFrame = new JFrame(); creates a JFrame that is

A

Invisible and has no title

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

You can set a JFrame named aFrame 300x200 pixels with

A

JFrame aFrame = new JFrame(300x200)l, aFrame.setSize(300x200); and aFrame.setBounds(300, 200);

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

When a user closes a JFrame, the default behavior is for

A

the JFrame to be hidden and the application to keep running

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

An advantage of extending the JFrame class is

A

You can set the child class properties within the class constructor

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

YOu can add a JLabel to a JFrame with

A

Frame1.add(label1);

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

The arguments required by the Font constructor include

A

Typeface, style, and point size

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

A class that controls component positioning in a JFrame is a

A

Layout manager

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

What can a user type text data into, its data can be set in the program instead of by the user, and a program can set its attributes so that a user cannot type in it

A

A JTextField

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

A parameter can be used in some JFrame constructors to set the

A

Initial text in the field

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

Within an event-driven program, a component on which an event is generated is the

A

Source

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

A class that will respond to button press events must use

A

Implements ActionListener in its header

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

Button1.addActionListener(this);

A

Will execute an actionPerformed() method when button1 is clicked

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

When you use the getSource() method with an ActionEvent object, the result is an

A

Object

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

A class can implement

A

As many listeners as it needs

17
Q

When you write a method that reacts to JCheckBox changes, you name the method

A

ItemStateChanged()

18
Q

If a class contains two components that might each generate a specific event type, you can determine which componenent caused the event by using the _____ method

A

GetSource()

19
Q

To group several components such as JCheckBoxes so that a user can select only one at a time, you create a

A

ButtonGroup

20
Q

What will be selected?
TwoOptions.setSelected(box1);
TwoOptions.setSelected(box2);

A

Box2 will be selected