Get the values entered in a TextField Thinathenet - Last answer on 12 Mar 2014 1 answer Hello, I would like to know please, how can we retrieve the values entered in a TextField so that we can use them in other calculations??? Show more Related links: Retrieve computer temperature in Java java action on a button move a button with the arrow keys in Java Is Java essential on a PC? Make a checkerboard in Java! JDBC Connection: Retrieve auto-increment id 1 answer Sorted by votes Votes Date Descending date Answer 1 / 1 tarek_dotzero Hello, The JTextField component contains a string; to retrieve it: String chaine = monTextField.getText(); If you want to perform calculations, that is, if you want to treat it as an integer for example, then you need to convert it: int n = Integer.parseInt(chaine); Good luck. Thinathenet Author Thank you so much Tarek, that’s kind :) !!!
Answer 1 / 1 tarek_dotzero Hello, The JTextField component contains a string; to retrieve it: String chaine = monTextField.getText(); If you want to perform calculations, that is, if you want to treat it as an integer for example, then you need to convert it: int n = Integer.parseInt(chaine); Good luck. Thinathenet Author Thank you so much Tarek, that’s kind :) !!!