Java Reference
In-Depth Information
12
.
Applets do not use constructors.
13
.
Java provides the
class
JTextArea
either to collect multiple lines of input
from the user or to display multiple lines of output.
14
.
Java provides the
class
es
JCheckBox
and
JRadioButton
to allow a user
to select a value from a set of given values.
15
.
A check box is also called a toggle button.
16
.
To force the user to select only one radio button at a time, you create a
button group and add radio buttons to the group.
17
.
A combo box, also known as a drop-down list, is used to select an item
from a list of possibilities.
18
.
A
JList
displays a number of items from which the user can select one or
more items.
19
.
The
FlowLayout
manager places GUI components from left to right until
no more items can be placed in a line. Then the next item is placed in the
following line.
20
.
In the case of
BorderLayout
manager, the component placed at the center
expands to occupy any unused regions.
21
.
Menus allow you to provide various functions without cluttering the GUI
with components.
22
.
Menus can be attached to objects such as
JFrame
and
JApplet
.
23
.
Key events are handled by the
interface
KeyListener
; mouse events are
handled by the
interface
s
MouseListener
and
MouseMotionListener
.
EXERCISES
1.
Mark the following statements as true or false.
a.
An applet's width and height are specified in the HTML file.
b.
In Java,
JApplet
is a class.
c.
To display an applet, you do not need to invoke a method, such as
setVisible()
.
d.
You must include an exit button in all Java applets.
e.
When an applet is loaded, the method
start
is invoked before the
method
init
.
f.
Check boxes are used to display the output of a program.
g.
A radio button always has a label.
h.
You use
JList
to create a combo box.
i.
JTextField
can be used to output multiple lines of text.
Search WWH ::
Custom Search