此内容没有您所选择的语言版本。
Chapter 24. Pet Store Example
24.1. Pet Store Example 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
All of the Java code for the Pet Store Example is contained in the file
PetStore.java. It defines the following principal classes (in addition to several classes to handle Swing Events):
Petstorecontains themain()method.PetStoreUIis responsible for creating and displaying the Swing based GUI. It contains several smaller classes, mainly for responding to various GUI events such as mouse button clicks.TableModelholds the table data. It is a JavaBean that extends the Swing classAbstractTableModel.CheckoutCallbackallows the GUI to interact with the Rules.Ordershowkeeps the items that the customer wishes to buy.Purchasestores details of the order and the products the customer is buying.Productis a JavaBean holding details of the product available for purchase and its price.