import java.applet.*; import java.awt.*; import java.net.*; public class Pa3 extends Panel{ Tah06 a; Applet apl; //TextArea ta=new TextArea(20, 20); Panel p, np, np2, pp, pp21, pp22, pp23, pp24; Nupp n1, n2, n3, n4, n5, n6, n7, n8; Nupp n21, n22, n23, n24, n25, n26, n27,n28, n29; int valitud=2; //TextField tf; Button butt=new Button(" * "); Pa3(Applet ap){ apl=ap; this.setBackground(Color.gray); p=new Panel(); p.add(a=new Tah06(300, 200)); setLayout(new BorderLayout()); add("Center", p); np=new Panel(); np.setLayout(new GridLayout(2, 9)); np.add(n1=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvsodi.gif"))); np.add(n2=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvkirjuta.gif"))); np.add(n3=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nlapp.gif"))); np.add(n4=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvuus.gif"))); np.add(n5=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nundo.gif"))); np.add(n6=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvvalge.gif"))); np.add(n7=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvmust.gif"))); np.add(n8=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvpunane.gif"))); np.add(butt); np.add(n21=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvali.gif"))); np.add(n22=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvjoon.gif"))); np.add(n23=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nruut.gif"))); np.add(n24=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvtruut.gif"))); np.add(n25=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "njuur.gif"))); np.add(n26=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nkriips.gif"))); np.add(n27=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nlaine.gif"))); np.add(n28=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvvalge.gif"))); np.add(n29=new Nupp(20, 20, ap.getImage(ap.getCodeBase(), "nvvalge.gif"))); add("South", np); a.summa=ap.getImage(ap.getCodeBase(), "summa.gif"); a.integraal=ap.getImage(ap.getCodeBase(), "integraal.gif"); //a.seaopkood(1); } public String pildistring(){return a.pildistring();} public void stringipilt(String s){a.stringipilt(s);} public boolean mouseUp(Event e, int x, int y){ if(e.target.equals(n1)){a.seaopkood(1);} if(e.target.equals(n2)){a.seaopkood(3);} if(e.target.equals(n3)){a.seaopkood(6);} if(e.target.equals(n4)){a.tuhjaks();} if(e.target.equals(n5)){a.tagasi();} if(e.target.equals(n6)){a.seaVarv(Color.white);} if(e.target.equals(n7)){a.seaVarv(Color.black);} if(e.target.equals(n8)){a.seaVarv(Color.red);} if(e.target.equals(n21)){ valitud=1; n26.seaPilt( apl.getImage(apl.getCodeBase(), "nloika.gif")); n27.seaPilt( apl.getImage(apl.getCodeBase(), "nkoopia.gif")); n28.seaPilt( apl.getImage(apl.getCodeBase(), "nliimi.gif")); n29.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); a.seaopkood(10); } if(e.target.equals(n22)){ valitud=2; n26.seaPilt( apl.getImage(apl.getCodeBase(), "nkriips.gif")); n27.seaPilt( apl.getImage(apl.getCodeBase(), "nlaine.gif")); n28.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); n29.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); a.seaopkood(20); } if(e.target.equals(n23)){ valitud=3; n26.seaPilt( apl.getImage(apl.getCodeBase(), "nring.gif")); n27.seaPilt( apl.getImage(apl.getCodeBase(), "nuruut.gif")); n28.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); n29.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); a.seaopkood(30); } if(e.target.equals(n24)){ valitud=4; n26.seaPilt( apl.getImage(apl.getCodeBase(), "ntring.gif")); n27.seaPilt( apl.getImage(apl.getCodeBase(), "nutruut.gif")); n28.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); n29.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); a.seaopkood(40); } if(e.target.equals(n25)){ valitud=5; n26.seaPilt( apl.getImage(apl.getCodeBase(), "ninte.gif")); n27.seaPilt( apl.getImage(apl.getCodeBase(), "nsumma.gif")); n28.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); n29.seaPilt( apl.getImage(apl.getCodeBase(), "nvalge.gif")); a.seaopkood(50); } if(e.target.equals(n26))a.seaopkood(10*valitud+1); if(e.target.equals(n27))a.seaopkood(10*valitud+2); if(e.target.equals(n28))a.seaopkood(10*valitud+3); if(e.target.equals(n29))a.seaopkood(10*valitud+4); return super.mouseUp(e, x, y); } public boolean action(Event e, Object arg){ if(e.target.equals(butt)){int nr; System.out.println(222+"k"); // a.seaopkood(nr=Integer.parseInt(tf.getText())); // System.out.println(nr+"k"); } return super.action(e, arg); } }