aspose file tools*
The moose likes Beginning Java and the fly likes User Prompt Timer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "User Prompt Timer" Watch "User Prompt Timer" New topic
Author

User Prompt Timer

podonga poron
Ranch Hand

Joined: May 12, 2008
Posts: 55
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

Joined: Aug 31, 2004
Posts: 11343

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);


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
podonga poron
Ranch Hand

Joined: May 12, 2008
Posts: 55
WOW !! now it works ! THANKS !!

i leave the code maybe someone find it useful ..

 
Consider Paul's rocket mass heater.
 
subject: User Prompt Timer
 
Similar Threads
TIMER CLASS
TimerTask and Schedule
Create a counter that increments once a second until a given number of seconds is reached
closing Simple message box
Set Timer