001 package videoautomat;
002 import sale.Action;
003 import sale.FormSheet;
004 import sale.FormSheetContentCreator;
005 import sale.JDisplayDialog;
006 import sale.SaleProcess;
007 import sale.SalesPoint;
008 import videoautomat.gui.Global;
009
010 /**
011 * This class implements a <code>JDisplayDialog</code> informing the customer that he/she has to insert the correct
012 * amount of money. Used when there isn`t enough change in the {@link VideoShop}s <code>MoneyBag</code>.
013 */
014 public class DisplayMoneyStockError extends JDisplayDialog {
015
016 /**
017 * Constructs a new <code>DisplayMoneyStockError</code> and shows it.
018 */
019 public DisplayMoneyStockError() {
020 super();
021 FormSheet fs = Global.getNoChangeFormSheet();
022 fs.addContentCreator(new FormSheetContentCreator() {
023 public void createFormSheetContent(FormSheet fs) {
024 fs.getButton(FormSheet.BTNID_OK).setAction(new Action() {
025 public void doAction(SaleProcess p, SalesPoint sp) {
026 closeFormSheet();
027 }
028 });
029 }
030 });
031 try {
032 popUpFormSheet(fs);
033 } catch (InterruptedException e1) {
034 e1.printStackTrace();
035 }
036 }
037 }