"

78 Javanotes 9.0, Quiz on Chapter 13

Quiz on Chapter 13

Question 1:

What is an “observable property”?

Question 2:

Suppose that input is a TextField and
that label is a Label. Suppose that you want
the text on the label to always be the same as the text in the text field.
Write two code segments to accomplish that, one using an event listener and
one using property binding.

Question 3:

Describe the picture that is produced by the following
code, where canvas is a Canvas:

GraphicsContext g = canvas.getGraphicsContext2D();
g.setFill(Color.WHITE);
g.fillRect(0,0,canvas.getWidth(),canvas.getHeight());
g.translate( canvas.getWidth()/2, canvas.getHeight()/2 );
g.rotate( 30 );
g.setFill(Color.RED);
g.fillRect(0,0,100,100);

Question 4:

Create a LinearGradient paint and use it to fill
the rectangle drawn by g.fillRect(100,100,300,200). The
rectangle should look like this, light gray at the top and black at the bottom:

a rectangle filled with a gray-to-black gradient

(The API for creating gradient paints is complicated. It’s OK to look it up!)

Question 5:

Suppose that g is a GraphicsContext.
Explain the purpose of the methods g.save() and g.restore().

Question 6:

What does the acronym MVC stand for, and how does it apply to the
List class?

Question 7:

What is the difference between a “modal” dialog box and a
“modeless” dialog box?

Question 8:

The Java API includes some classes in a package named org.w3c.dom.
Why such a funny package name?

Question 9:

Suppose that closeItem is a MenuItem.
What is done by the following statement? (What is an “accelerator”?)

closeItem.setAccelerator( KeyCombination.valueOf("ctrl+W") );

Question 10:

What is meant by Internationalization of a program?

See the Answers

License

ITP 220 Advanced Java Copyright © by Amanda Shelton. All Rights Reserved.