Java Reference
In-Depth Information
2.
Name four GUI components that can be used for input only.
3.
Name two GUI components that can be used for both input and output.
4.
Name a GUI component that can be used for output only.
5.
Why do you need check boxes in a GUI program?
6.
Fill in the blanks in each of the following:
a.
The ______ method of the
class
Graphics
draws a rectangle.
b.
RGB is short for ____, ____, and ______.
c.
The method _______ is invoked when an item is selected from a combo
box and a(n) _______ is registered to handle an event.
d.
The _______ method of the
class
Graphics
can be used to draw a
circle.
e.
Font sizes are specified in units called _____.
f.
Both
JTextField
and
JTextArea
inherit directly from the
class
________.
g.
The method
Random
returns a value between ______ and ________.
h.
The method _________ gets the string in the
JTextArea
, and the
method _______ changes the string displayed in a
JTextArea
.
i.
The
BorderLayout
manager divides the container into five regions:
______, ______, ______, ______, and ______.
j.
The ______ class is used to create a slider for ____________.
k.
You cannot use
System.out.println
inside a(n) ______ method.
7.
Write the necessary statements to create the following:
a.
A
JList
with the list items
orange
,
apple
,
banana
,
grape
, and
pineapple
b.
A check box with the label
draft
c.
A group of three radio buttons with the labels
home
,
visitor
, and
neutral
d.
A menu bar
e.
A Courier bold 32-point font
f.
A new color that is not already defined in the
class
Color
8.
Correct any syntax errors in the following program:
//Grand Welcome Problem Applet
1
2
import
java.awt.*;
import
javax.swing.JApplet;
public class
GrandWelcomeProblem extends JApplet
{
public
int()
Search WWH ::
Custom Search