package monitorji; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.util.Stack; public class Monitorji extends Applet { Stack cakaDodaj=new Stack (), cakaOdvzemi=new Stack (); int velikostPomn=10, velikostPocakaj=45, sirinaPocakaj=4, premor, polnostPomn, nasDodaj, nasOdvzemi; boolean pomnilnik []=new boolean [velikostPomn]; Image puscicaGor, puscicaDol, semaforZelen, semaforRdec; PlatnoPuscici puscici=new PlatnoPuscici (); PlatnoSemaforja semaforja=new PlatnoSemaforja (); Panel prikazPomn []=new Panel [velikostPomn], prikazPocakaj []=new Panel [velikostPocakaj]; Obdelava obdelovalec; boolean isStandalone = false; Button btDodaj = new Button(); Button btOdvzemi = new Button(); Scrollbar sbPremor = new Scrollbar(); Label lblNiPolno = new Label(); Label lblNiPrazno = new Label(); Label lblNasDodamo = new Label(); Label lblNasOdvzamemo = new Label(); Label lblPremor = new Label(); TextArea txtDodaj = new TextArea(); TextArea txtOdvzemi = new TextArea(); private void izpis () { int i; txtDodaj.setText (""); for (i=0; i0) grf.drawImage (semaforZelen, 0, 30, this); else grf.drawImage (semaforRdec, 0, 30, this); } } public class PlatnoPuscici extends Canvas { public void paint (Graphics grf) { grf.drawImage (puscicaDol, 7+nasDodaj*35, 0, this); grf.drawImage (puscicaGor, 7+nasOdvzemi*35, 70, this); } } public class Obdelava extends Thread { private void pocakaj () { int i; btDodaj.setEnabled (false); btOdvzemi.setEnabled (false); for (i=0; i=500) prikazPocakaj [i].setVisible (true); try { sleep ((int)(premor/2/velikostPocakaj)); } catch (InterruptedException e) { } } for (i=0; i=500) prikazPocakaj [i].setVisible (false); try { sleep ((int)(premor/2/velikostPocakaj)); } catch (InterruptedException e) { } } btDodaj.setEnabled (true); btOdvzemi.setEnabled (true); } public void run () { izpis (); if ((polnostPomn0) && (!cakaOdvzemi.empty ())) { pocakaj (); odvzemi (); izris (); } if ((polnostPomn