Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

User Prompt Timer

 
podonga poron
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code sets a timer task in console.



But i want to implement a user prompt, to the code .. so the user can easily set the value of refreshing time ..

something like this ...



but the problem with this is i can't pass a String to the constructor ..

Is there a way to pass a int value, maybe with casting ? what is the correct way to do this ?

thanks a lot !
[ May 12, 2008: Message edited by: podonga poron ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't do it with casting, because a String is simply not an int.

But you can parse a String as an int using the parseInt method of the Integer class...

int myInt = Integer.parseInt(myString);
 
podonga poron
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WOW !! now it works ! THANKS !!

i leave the code maybe someone find it useful ..

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic