ernieJava

advertisement
11.1
A) Method mouseMoved is called when the mouse is moved with no buttons
pressed and an event listener is registered to handle the event.
B) Text that cannot be modified y the user is called uneditable text.
C) A layout manager arranges the GUI components in a Container.
D) The add method for attaching GUI components is a method of class Container.
E) GUI is an acronym for Graphical User Interface.
F) Method setLayout is used to specify the layout manager for a container.
G) A mouseDragged method call is preceded by a mousePressed method call and
followed by a mouseReleased method call.
H) Class JOptionPane contains methods that display message dialogs and input
dialogs.
I) An input dialog capable of receiving input from the user is displayed with
method showInputDialog of class JOptionPane.
J) A dialog capable of displaying a message to the user is displayed with method
showMessageDialog of class JOptionPane.
K) Both JTextField and JTextArea directly extend class JTextComponent.
11.2
A) True
B) False, Method mouseEntered is called.
C) False, A JPanel can be added to another JPanel, because JPanel is an indirect
subclass of Component. Therefore, a JPanel is a Component. Any Component can
be added to a Container.
D) False, Only the last button added will be displayed. Remember that only one
component should be added to each region in a BorderLayout.
E) True
F) False, Inner classes have access to all members of the enclosing declaration.
G) False, JTextAreas are editable by default.
H) False, JTextArea derives from class JTextComponent.
11.3
A) buttonName = new JButton( “Caption”);
B) JLabel is a class name and cannot be used as a variable name
JLabel aLabel, notJLabel;
C) Reverse arguments passed – txtField = new JTextField(“Default text”, 50);
D) Due to the use of borderLayout a region must be set. Because a region is not
set, both buttons will be added to the same region.
11.4
A) JTextComponent
B) add
C) mouseReleased
D) ButtonGroup
11.5
A) True
B) True
C) False, you must use ButtonGroups to make them mutually exclusive
D) True
E) False, that is determined in the setLayout thingie.
F) True
11.6
A) False, it’s a component
B) True
C) False, it’s a component
D) False, it’s a component
E) True
F) True
G) False, it’s a subclass of a Container
11.7
A) Need a semicolon at the end
B) Syntax is gridLayout1 = new GridLayout(8,8)
C) You don’t need FlowLayout.DEFAULT in the statement
D) You don’t need “container.” at the beginning.
12.1
A) In Java 2D, method setStroke of class Graphics2D sets the characteristics of a
line used to draw a shape.
B) Class GradientPaint helps specify the fill for a shape such that the fill gradually
changes from one color to another.
C) The drawLine method of class Graphics draws a line between two points.
D) RGB is short for red, green and blue.
E) Font sizes are measured in units called points.
F) Class TexturePaint helps specify the fill for a shape using a pattern drawn in a
buffered image.
12.2
A) False, The first two arguments specify the upper-left corner of the bounding
rectangle.
B) True
C) True
D) True
E) False, Font sizes are measured in points.
F) False, The coordinate (0,0) corresponds to the upper-left corner of a GUI
component on which the drawling occurs.
Download