示例#1
0
  public MarketPanel(MarketGui gui) {
    this.gui = gui;
    host.setGui(hostGui);
    host.setAnimPanel(gui.animationPanel);

    gui.animationPanel.addGui(hostGui);

    iconDescription = new ImageIcon(getClass().getResource("/resources/img_market.png"));
    picDescription = new JLabel(iconDescription);
    host.startThread();

    setLayout(new GridLayout(1, 2, 20, 20));
    group.setLayout(new GridLayout(1, 2, 10, 10));

    group.add(customerPanel);
    // group.add(waiterPanel);

    initRestLabel();
    add(restLabel);
    add(group);

    this.addTeller("Clerk 1");
    this.addTeller("Clerk 2");
    this.addTeller("Clerk 3");
  }
示例#2
0
  public void pause() {
    host.pauseAgent();

    for (MarketCustomer c : customers) {
      c.pauseAgent();
    }
    for (MarketWorkerAgent w : waiters) {
      w.pauseAgent();
    }
  }
示例#3
0
  public void resume() {
    host.resumeAgent();

    for (MarketCustomer c : customers) {
      c.resumeAgent();
    }
    for (MarketWorkerAgent w : waiters) {
      w.resumeAgent();
    }
  }
示例#4
0
 public void addTeller(String name) {
   waiterindex++;
   MarketWorkerAgent w = new MarketWorkerAgent(name, waiterindex);
   MarketTellerGui g = new MarketTellerGui(w, gui, waiterindex);
   gui.animationPanel.addGui(g);
   w.setHost(host);
   w.setAnimPanel(gui.animationPanel);
   host.msgNewTeller(w);
   w.setGui(g);
   waiters.add(w);
   w.startThread();
 }