I've written a GUI for a simulation project that I'm doing, and in the event handling code of the window, I have, for instance,
private void timestepKeyTyped(java.awt.event.KeyEvent evt) {
String text = timestep.getText();
AMEC.steptime = Integer.parseInt(text);
}
where I would like to assign any input typed into field timestep to be assigned to AMEC.steptime. I do this for all textfields.
However, my simulation doesn't run properly when passed these parameters, and upon debugging I found that only the first character gets parsed to int. For instance, if I type "31", then the value assigned to AMEC.steptime becomes 3 instead of 31.
How do I fix this?