Java Reference
In-Depth Information
L ISTING 20.2
Continued
/**
Get the total number of items currently in the shopping cart.
*/
public void empty() {
Enumeration enum = items.elements();
String[] item;
while (enum.hasMoreElements()) {
item = (String[])enum.nextElement();
removeItem((String)item[0]);
}
}
}
As you can see, the ShoppingCart contains the basic functionality to add, remove, and display
its contents. We will look at it further as you use it in the application.
Views
Now you need to define the interface that your users will interact with. From our requirements
defined in the first section of this chapter you will need to create four views and an error page.
Catalog Layout
Each of these pages, excluding the error page, will have the basic layout shown in Figure 20.1.
Title Bar
N
a
v
i
g
a
t
i
o
n
Client Area
F IGURE 20.1
The catalog view layout.
Search WWH ::




Custom Search