Questo contenuto non è disponibile nella lingua selezionata.
Chapter 24. Pet Store Example
24.1. Pet Store Example Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
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.