package PS7; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; import java.util.*; public class SystemFrame extends JFrame { StackingAreaPanel stackArea; StereoProdPanel prodChoices; StereoShipPanel prodShip; ArrayQueue[] prodLine; Robot1 r; TransferCar t; StackArea[] myStackArea; /** Creates new SystemFrame */ public SystemFrame(StackArea [] s, ArrayQueue[] prodLines) { myStackArea=s; prodLine=prodLines; setTitle("Process"); stackArea = new StackingAreaPanel(s); prodChoices = new StereoProdPanel(this); prodShip = new StereoShipPanel(this); Container c = getContentPane(); c.setLayout(new FlowLayout()); c.add(prodChoices); c.add(stackArea); c.add(prodShip); r= new Robot1(); t= new TransferCar(); } public void updateStackingAreaPanel() { stackArea.updateDrawing(); } public void stereosProduced(int [] lines) { for (int j=0; j < 2; j++) { // Loop over the 2 production lines for (int k=0; k < (8- 4*j); k++) // 8 items/batch in line 0, 4 items/batch in line 1 prodLine[j].add(new Product(lines[j])); } r.moveProduct(prodLine[0], myStackArea[lines[0]], 4); r.moveProduct(prodLine[1], myStackArea[lines[1]], 4); r.moveProduct(prodLine[0], myStackArea[lines[0]], 4); stackArea.updateDrawing(); } public void stereosShipped(int [] order) { t.pickProduct(myStackArea, order); stackArea.updateDrawing(); } }