Quiz on Chapter 13
This page contains questions on Chapter 13 of Introduction to Programming Using Java. You should be able to answer these questions after studying that chapter. Sample answers to these questions can be found here.
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, were 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:
(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 8 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?