Java Reference
In-Depth Information
**17.9
(
Demonstrate
JLabel
properties
) Write a program to let the user dynami-
cally set the properties
horizontalAlignment
,
verticalAlignment
,
horizontalTextAlignment
, and
verticalTextAlignment
, as shown in
Figure 17.24.
Panel with
GridLayout
Panel with
BorderLayout
Panel with
BorderLayout
Panel with
GridLayout
for two combo boxes
Panel with
GridLayout
for two labels
Panel with
GridLayout
for two combo boxes
Panel with
GridLayout
for two labels
F
IGURE
17.24
You can set the alignment and text-position properties of a label dynamically.
*17.10
(
Mandelbrot fractal
) Programming Exercise 15.20 displays Mandelbrot fractal.
Note that the values
77
,
58
, and
159
in line 15 in the
MandelbrotCanvas
class
in Programming Exercise 15.20 impact the color of the image. Revise the pro-
gram to let the user enter these values from text fields dynamically, as shown in
Figure 17.25a.
(a) (b)
F
IGURE
17.25
(a) The program enables the user to set the colors dynamically. (b) You can set a text field's properties for
the horizontal alignment and column size dynamically.