Evening all, just wondering. Im currently using an int, int i = 100; this
sets the timer to count down from, all works fine..
But now im trying to change the int i to a value the user inputs via a
textbox. Cant seem to figure it out, trying things like, textBox.getText()
just cant get to grasps with it, any ideas?
Cheers
Lee Weiner - 30 Nov 2003 19:36 GMT
>Evening all, just wondering. Im currently using an int, int i = 100; this
>sets the timer to count down from, all works fine..
[quoted text clipped - 3 lines]
>
>Cheers
getText() returns a String. You have to convert it to an int to assign it to
your variable.
int i = Interger.parseInt( textBox.getText() );
Lee Weiner
lee AT leeweiner DOT org
Andrew Marshall - 01 Dec 2003 04:56 GMT
> Evening all, just wondering. Im currently using an int, int i = 100; this
> sets the timer to count down from, all works fine..
[quoted text clipped - 3 lines]
>
> Cheers
If you type the text into the field, you need to have some sort of
listener to a button, that when pressed, calls: textBox.getText() and then
parses it as an integer. you can then take that and do whatever you want
to it.
Andrew.
Sunny - 01 Dec 2003 18:34 GMT
> > Evening all, just wondering. Im currently using an int, int i = 100; this
> > sets the timer to count down from, all works fine..
[quoted text clipped - 10 lines]
>
> Andrew.
Cheers, for further reference, this is the code i used:
##########################
int t = 0;
t = Integer.parseInt( txtField.getText() );
timer.start();
##########################
Works fine :)