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.
What is an "observable property"?
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.
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);
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!)
Suppose that g is a GraphicsContext. Explain the purpose of the methods g.save() and g.restore().
What does the acronym MVC stand for, and how does it apply to the List class?
What is the difference between a "modal" dialog box and a "modeless" dialog box?
The Java 8 API includes some classes in a package named org.w3c.dom. Why such a funny package name?
Suppose that closeItem is a MenuItem. What is done by the following statement? (What is an "accelerator"?)
closeItem.setAccelerator( KeyCombination.valueOf("ctrl+W") );
What is meant by Internationalization of a program?