Possible Duplicate:
Best way to constrain user to enter a time in a JTextField
I Use window builder in Eclipse, I've a JTextField and i want to set the hour as text (hh:mm:ss). I've some troubles; does anybody can help me? thank you
Possible Duplicate:
Best way to constrain user to enter a time in a JTextField
I Use window builder in Eclipse, I've a JTextField and i want to set the hour as text (hh:mm:ss). I've some troubles; does anybody can help me? thank you
use java date & time. example:
import java.util.*;
...
// Create a Gregorian calendar initialized
// with the current date and time in the
// default locale and timezone.
GregorianCalendar gcalendar = new GregorianCalendar();
String hr = ("" + gcalendar.get(Calendar.HOUR) + ":");
String min = ("" + gcalendar.get(Calendar.MINUTE) + ":");
String sec = ("" + gcalendar.get(Calendar.SECOND));
then do:
<textFieldName>.setText(hr + min + sec);
that will change the text in the textfield to "HH:MM:SS"