when i started to make this
i used the
import javax.swing.JOptionPane;
// for button menu ask setpoint input
//_________________________________________________________________ askI call: A = askI("A",A);
int askI(String ask, int I) {
String r = JOptionPane.showInputDialog(null, "new Setpoint for "+ask+" (now "+I+" )", "Input (INT)", JOptionPane.QUESTION_MESSAGE);
if (r == null ) {
print(" NULL ");
r = str(I);
} // handle CANCEL
try {
I = Integer.parseInt(r);
}
catch(NumberFormatException e) {
println("you did not enter a int number!");
}
println("new "+ask, I);
return I;
}
//_________________________________________________________________ askF call: A = askF("A",A);
float askF(String ask, float F) {
String r = JOptionPane.showInputDialog(null, "new Setpoint for "+ask+" (now "+F+" )", "Input (FLOAT)", JOptionPane.QUESTION_MESSAGE);
if (r == null ) {
print(" NULL ");
r = str(F);
} // handle CANCEL
try {
F = Float.parseFloat(r);
}
catch(NumberFormatException e) {
println("you did not enter a int or float number!");
}
println("new "+ask, F);
return F;
}
int a = 0;
float b = PI;
void setup() {
a = askI("input a ", a);
b = askF("input b ", b);
println("a "+a+" b "+b);
}
void draw() {
}