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 * Constructs a new <code>DisplayMoneyStockError</code> and shows it.
018 */
019 public DisplayMoneyStockError() {
020 super();
021 FormSheet fs = new MsgForm(
022 "No change!",
023 "There is not enough change in here.n"
024 + "Please insert the correct amount of moneyn"
025 + "or contact the hotline.");
026
027 fs.addContentCreator(new FormSheetContentCreator() {
028 public void createFormSheetContent(FormSheet fs) {
029 fs.getButton(FormSheet.BTNID_OK).setAction(new Action() {
030 public void doAction(SaleProcess p, SalesPoint sp) {
031 closeFormSheet();
032 }
033 });
034 }
035 });
036 try {
037 popUpFormSheet(fs);
038 } catch (InterruptedException e1) {
039 e1.printStackTrace();
040 }
041 }
042 }