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 sale.stdforms.MsgForm; 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 * ID for Serialization. 018 */ 019 private static final long serialVersionUID = 5857508089955396734L; 020 021 /** 022 * Constructs a new <code>DisplayMoneyStockError</code> and shows it. 023 */ 024 public DisplayMoneyStockError() { 025 super(); 026 FormSheet fs = new MsgForm( 027 "No change!", 028 "There is not enough change in here.\n" 029 + "Please insert the correct amount of money\n" 030 + "or contact the hotline."); 031 032 fs.addContentCreator(new FormSheetContentCreator() { 033 private static final long serialVersionUID = 7987316125303271072L; 034 035 public void createFormSheetContent(FormSheet fs) { 036 fs.getButton(FormSheet.BTNID_OK).setAction(new Action() { 037 private static final long serialVersionUID = 1060004498677039521L; 038 039 public void doAction(SaleProcess p, SalesPoint sp) { 040 closeFormSheet(); 041 } 042 }); 043 } 044 }); 045 try { 046 popUpFormSheet(fs); 047 } catch (InterruptedException e1) { 048 e1.printStackTrace(); 049 } 050 } 051 }