Answer:
JTextField.getText()
User Input
A JTextField holds the text that the user entered into the field.
Your program can get that text using the getText() method.
But, even though the user might have entered a string of digits, you can't retrieve a
numeric type (like int) from the field.
Your program must retrieve the text, and then convert it to a number.
Luckily, the parseInt() method of the wrapper class Integer can
convert appropriate text into an int.
It is a static method, so you do not need to construct an object to use it.
Here is the program so far. To finish it fill in the remaining blanks.
- Use the
getText()method to get the user's input. - Use the
parseInt()static method of the wrapper classIntegerto convert the input to anint. - Use the
setText()method to convert and display the result inoutCel.
QUESTION 6:
What is going on with:
outCel.setText( celsTemp+"" );