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

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









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.ADS_TO_REPLACE_1
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
how to print the server time
how to print the server time  how to print the server time in jsp and update time in fix interval
Run time polymorphism
Run time polymorphism  What is run time polymorphism or dynamic method dispatch
Last modified time of a webpage
Last modified time of a webpage  how can we get the last modified time of a webpage using java
Java run time polymorphism
Java run time polymorphism  What is run-time polymorphism or dynamic method dispatch
time and space complexity
time and space complexity  sort the data structures according to efficient time and space utilisation
Mysql Time Operation
Mysql Time Operation       Mysql Time Operation performs the subtraction and addition of time... Time Operation. To understand an example from Time Operation , we use keyword
ModuleNotFoundError: No module named 'time'
ModuleNotFoundError: No module named 'time'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'time' How to remove the ModuleNotFoundError: No module named 'time' error
Time Calculation - JSP-Servlet
Time Calculation  I am using Time data type to store the start and end time of a client and i want to generate a appointment schedule for him. i stored start and end time and also the interval the client will attend
how to print the server time
how to print the server time  i want to print database time in clintside and update time in every secound without creating connection to database for each time. how can i do
date time picker
date time picker  I have enetered a date time picker in my jsp file. there is text field before the date time picker. What should i do so... the date time picker gets opened
time conversion - Date Calendar
time conversion  hoe to add time in php like 01:30:00 and 00:45:20 and 02:50:40
Outsourcing Time Factors, How to Examine Outsourcing Time
Outsourcing- Time Factors Introduction Apart from the choice of vendors.... In this article we will examine the factors associated with time. How Long is too... for longer duration contracts. This is because such situations need time
Run time exception
Run time exception  What class of exceptions are generated by the Java run-time system?  Java runtime system generates RuntimeException and Error exceptions
HOW TO SHOW TIME SERIES
HOW TO SHOW TIME SERIES  hi................ i require a small code in java swings to display the output as time series. Can u plz help???????? Reply....... thanks in advance
Time Table in Java
Time Table in Java  Hi, Deepak i am developing a time table for a school on java,but i am confuse how to start so please give me idea about
php parse string to time
php parse string to time  I am looking for a solution to parse a string into a formatted date time string
running time watch
running time watch   how to set running watch in applycation with ajax
uitableviewcell loading time interval
uitableviewcell loading time interval  How can i check the time... time intervals between two cells in XCode. Just see the given lines of code...( @"Elapsed time to generate cell %.2d", [date timeIntervalSinceNow
Time series sorce code
Time series sorce code   hi.......... I want to show the output of my project as time series. Can u give me a simple code for time series. Where i amble able to put on x-axis the date and y-axis the range.? I require the time

Ads