Java Reference
In-Depth Information
out , with the components in the NORTH region, the main drawing panel in the CENTER region, and a
status bar in the SOUTH region, as in Fig. 12.49. In the top panel, create the components listed
below. Each component's event handler should call the appropriate method in class DrawPanel .
a) A button to undo the last shape drawn.
b) A button to clear all shapes from the drawing.
c) A combo box for selecting the color from the 13 predefined colors.
d) A combo box for selecting the shape to draw.
e) A checkbox that specifies whether a shape should be filled or unfilled.
Declare and create the interface components in DrawFrame 's constructor. You'll need to create
the status bar JLabel before you create the DrawPanel , so you can pass the JLabel as an argument
to DrawPanel 's constructor. Finally, create a test class that initializes and displays the DrawFrame to
execute the application.
Fig. 12.49 | Interface for drawing shapes.
12.18 (GUI-Based Version of the ATM Case Study) Reimplement the Optional ATM Case Study
of Chapters 33-34 as a GUI-based application. Use GUI components to approximate the ATM
user interface shown in Fig. 33.1. For the cash dispenser and the deposit slot use JButton s labeled
Remove Cash and Insert Envelope . This will enable the application to receive events indicating when
the user takes the cash and inserts a deposit envelope, respectively.
Making a Difference
12.19 (Ecofont) Ecofont ( www.ecofont.eu/ecofont_en.html )—developed by SPRANQ (a Neth-
erlands-based company)—is a free, open-source computer font designed to reduce by as much as
20% the amount of ink used for printing, thus reducing also the number of ink cartridges used and
the environmental impact of the manufacturing and shipping processes (using less energy, less fuel
for shipping, and so on). The font, based on sans-serif Verdana, has small circular “holes” in the
letters that are not visible in smaller sizes—such as the 9- or 10-point type frequently used. Down-
load Ecofont, then install the font file Spranq_eco_sans_regular.ttf using the instructions from
the Ecofont website. Next, develop a GUI-based program that allows you to type in a text string to
be displayed in the Ecofont. Create Increase Font Size and Decrease Font Size buttons that allow you
 
Search WWH ::




Custom Search