JTextField is an input form that contains a String value means that all data (including number) of the JTextField is a String, So, how if we...
JTextField is an input form that contains a String value means that all data (including number) of the JTextField is a String,
So, how if we want to take a numeric value in the string and we want to make it function as an Integer type ?? The following is a conversation between you (Y) and your friend (YF):
YF: "is it can treat a String value serves as Intiger ??"
Y: "Well the question you nice .. :), could have been"
YF: "future"? How to do? "
Y: "really want to know? OK, follow me
suppose you create a JTextField with the variable named jTextField1
# First way make Integer variable by using Integer.ParseInteger () directly refer to the following example: int a = Integer.ParseInteger (jTextField1.getText ());
# Second way make Integer variable by using Integer.ValueOf () directly check it for example int a = Integer.ValueOf (jTextField1.getText ())
YF: and than?
Y: yah just it the values from jTextField is useable (a + 1 and if in jTextField1 you type 3 then the result is 4)
Y: Oh ..like that.. OK Thanks Bro.. ... :)