I am new to JAVA, I am trying to convert an input from a JTextField into an integer, I have tried loads of options but nothing is working, the eclipse is always giving me an
In place of:
JTextField f1 = new JTextField("-5"); //xaxis1 = Integer.parseInt(f1);
try this:
JTextField f1 = new JTextField("-5"); String text = f1.getText(); int xaxis1 = Integer.parseInt(text);
You cannot parse TextField to Integer, but you can parse its value contained - text.
TextField
Integer