Element f = simulator.getObject("el00242"); Element point = simulator.getObject("el01817"); Element sp1 = simulator.getObject("el00248"); Element sp2 = simulator.getObject("el00251"); Element sp3 = simulator.getObject("el00254"); Element sp4 = simulator.getObject("el00258"); Element sp5 = simulator.getObject("el00261"); Element spx = simulator.getObject("el00372"); Element tf = simulator.getObject("el01710"); tf.setEnabled(false); tf.update(); /*Element ts2 = simulator.getObject("Text shape_0002"); physicon.dsi.shapes.TTextShape ord = (physicon.dsi.shapes.TTextShape)ts2.getElement();*/ //Element b = simulator.getObject("el00257"); String command; double a,b,A,B,n,x,y,t; while (true) { command = simulator.getNextEvent(); if (command.equals("buttonClick") || command.equals("abscChange")) { a=sp1.getDouble("Value"); b=sp2.getDouble("Value"); A=sp3.getDouble("Value"); B=sp4.getDouble("Value"); n=sp5.getDouble("Value"); f.set("Function", A+ "*(" +a+ "*x+" +b+ ")^(" +n+ ")+" +B); if(n<0) { t=-n; f.set("Function", A+ "/((" +a+ "*x+" +b+ ")^" +t+ ")+" +B); } f.update(); } /*if (command.equals("abscChange") || command.equals("buttonClick")) { x=spx.getDouble("Value"); point.set("Var1",x); point.update(); y=point.getDouble("Var2"); ord.setText(DecUtil.fString(y,2)); }*/ if (command.equals("textChanged") || command.equals("abscChange") || command.equals("buttonClick")) { x=spx.getDouble("Value"); point.set("Var1",x); if((java.lang.Math.floor(n)!=n && a*x+b<0) || (n<=0 && a*x+b==0)) { //point.set("Var2",y); point.setVisibility(false); tf.set("Caption","undef"); } else { y=A*java.lang.Math.pow(a*x+b,n)+B; point.set("Var2",y); point.setVisibility(true); tf.set("Caption",DecUtil.fString(y,2)); } point.update(); //y=point.getDouble("Var2"); //ord.setText(DecUtil.fString(y,2)); //tf.set("Caption",DecUtil.fString(y,2)); tf.update(); } Thread.sleep(100); }