Home Segments Top Top Previous Next

917: Mainline

Later on, if you want a program to change what appears in a text field, the setText method does the work. To deal with integers, you must first convert the number into a string using the valueOf class method found in the String class. Thus, the following sets the text from a string obtained from the integer, value1:

field1.setText(String.valueOf(value1))