time

 
 

Share on Google+Share on Google+

sanjeev patiyal
time
2 Answer(s)      6 years and 11 months ago
Posted in : Date-Calendar
Ads

sir,

i want to show system time on a textfield in awt(java). woulk you send me an example of time which can show time in standard format like H:M:S

pls help me sir

Ads
View Answers

February 12, 2011 at 12:21 PM


Display time in JTextField

import java.util.*;
import javax.swing.*;
import java.awt.event.*;

public class ShowTime extends JFrame{
    ShowTime(){
    JTextField text=new JTextField(10);
      add(text);
      text.setEditable(false);
      pack();
      setVisible(true);
      while(true){
      try {
      Thread.sleep(1000);
      Calendar cal = new GregorianCalendar();
      String hour = String.valueOf(cal.get(Calendar.HOUR));
      String minute = String.valueOf(cal.get(Calendar.MINUTE));
      String second = String.valueOf(cal.get(Calendar.SECOND));
      text.setText(hour + ":" + minute + ":" + second);
      } 
      catch (Exception e) {}
      }
   }
public static void main(String args[]){
new ShowTime();
}
}


April 5, 2011 at 12:37 PM


thank you sanjeev


Ads









Related Tutorials/Questions & Answers:
time
time  how to find the current system time between the user login and logout using java
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
Advertisements
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do? For this i already received the answer. But its converting the time in 24hr format to 12hr format
time
time  sir, i want to show system time on a textfield in awt(java). woulk you send me an example of time which can show time in standard format like H:M:S pls help me sir   Display time in JTextField import
time
time format hh:mm:ss  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do?   Here is a jsp example that fetch the time from the database and display
time
time display only as hh:mm.  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do?   Here is a jsp example that fetch the time from the database
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do?   Here is a jsp example that fetch the time from the database and display in different
time
time  Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do?   Here is a jsp example that fetch the time from the database and display in different
time
retrieved time from mysql database  Hi. I have retrieved time from.... wat to do?   Here is a jsp example that fetch the time from... is a jsp example that fetch the time from the database and display in different
time ()
PHP time() Function The time() returns the current time  measured...;). Syntax of time() Function in PHP time(void) Parameter of time() Function in PHP void - void is optional parameter.  Example of time
time format
time format  How to seperate time from following DateFormat dateFormat = new SimpleDateFormat("yyyy-dd-mm HH:mm:ss.S
time difference
time difference  How to subtract time? 12:38:35 pm - 00:15:48 am plz raply soon
calculate the time ..
calculate the time ..  [CODE] Elapsed Time Example...() { startTime = new Date(); alert("Time Started...(); alert("Time Stopped"); } function calculateTimeElapsed
System Time
System Time  how do i store the system time in a variable in BlueJ
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
Time validation
Time validation  Hi. I have a text box in html to get time... project.   Here is a code that accepts the time in the format hh:mm. If the user enters the time in wrong format, it displays the error message. <
time decrement
time decrement  i want to know calculate the time for 2 minutes(from current time started),after that the button in the page will be disable  ... minute. You can increase time interval as per your requirement. <!DOCTYPE HTML
Session time
Session time   I need to develop an application has a user id and password to login and maintain the session for 8 minutes. All the pages under the login are not available if there is no activity for 8 minutes
Version of joda-time>joda-time dependency
List of Version of joda-time>joda-time dependency
convert date time to int
convert date time to int  convert date time to int
get absolute time java
get absolute time java  How to get absolute time in java
Time display - JSP-Servlet
Time display   In a web application or ina website if we display the time getting as system time, whether it is server' system time or client' system time. Is there any difference between getting time using java Date
Version of joda-time>joda-time-hibernate dependency
List of Version of joda-time>joda-time-hibernate dependency
Version of joda-time>joda-time-jsptags dependency
List of Version of joda-time>joda-time-jsptags dependency

Ads

 
Advertisement null

Ads