quick java help

dasoldier

Limp Gawd
Joined
Apr 29, 2005
Messages
185
save my life... I can't figure out how to make jtextfield get a number....

I want a Jtextfield to always display the number of the variable called stones but can't figure out how to do this.

jTextField2.setText(? ); ?= I want to display the number that is in the variable stones in that column.
 
I think I understand what you want

Code:
jTextField2.setText(stones.ToString());

// Following could throw exception if jTextField2 doesn't contain a real number e.g. "blah"
int stones = Integer.parseInt(jTextField2.getText());
 
Back
Top