Java Reference
In-Depth Information
b)
Container
method
attaches a GUI component to a container.
c)
Method
is called when a mouse button is released (without moving the
mouse).
d)
The
class is used to create a group of
JRadioButton
s.
12.5
Determine whether each statement is
true
or
false
. If
false
, explain why.
a) Only one layout manager can be used per
Container
.
b) GUI components can be added to a
Container
in any order in a
BorderLayout
.
c)
JRadioButton
s provide a series of mutually exclusive options (i.e., only one can be
true
at a time).
d)
Graphics
method
setFont
is used to set the font for text fields.
e)
A
JList
displays a scrollbar if there are more items in the list than can be displayed.
f)
A
Mouse
object has a method called
mouseDragged
.
12.6
Determine whether each statement is
true
or
false
. If
false
, explain why.
a) A
JPanel
is a
JComponent
.
b) A
JPanel
is a
Component
.
c) A
JLabel
is a
Container
.
d) A
JList
is a
JPanel
.
e) An
AbstractButton
is a
JButton
.
f) A
JTextField
is an
Object
.
g)
ButtonGroup
is a subclass of
JComponent
.
12.7
Find any errors in each of the following lines of code, and explain how to correct them.
a)
import
javax.swing.JFrame
b)
panelObject.GridLayout(
8
,
8
);
c)
container.setLayout(
new
FlowLayout(
FlowLayout.DEFAULT
));
d)
container.add(eastButton,
EAST
);
face
12.8
Create the following GUI. You do not have to provide any functionality.
12.9
Create the following GUI. You do not have to provide any functionality.
12.10
Create the following GUI. You do not have to provide any functionality.