Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how can create clock baisc in java

Have Programming Question? Ask it here!
 
 
 


didar sham
how can create clock baisc in java
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners


think u for help me ..


Advertisement
View Answers

April 27, 2011 at 11:06 AM


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

public class DisplayClock extends JFrame {
     DisplayClock() {
        final JLabel timeField = new JLabel();
        timeField.setFont(new Font("sansserif", Font.PLAIN, 20));

        Container content = this.getContentPane();
        content.setLayout(new FlowLayout());
        content.add(timeField); 

        setTitle("Clock");
        setSize(100,70);

        javax.swing.Timer t = new javax.swing.Timer(1000,new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            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));
            timeField.setText("" + hour + ":" + minute + ":" + second);
            }
        });
        t.start(); 
    }
    public static void main(String[] args) {
        JFrame clock = new DisplayClock();
        clock.setVisible(true);
    }
}


Related Tutorials/Questions & Answers:
how can create clock baisc in java
how can create clock baisc in java   think u for help me ..  ...()); content.add(timeField); setTitle("Clock"); setSize(100,70...) { JFrame clock = new DisplayClock(); clock.setVisible(true
how can create clock baisc in java
how can create clock baisc in java   think u for help me ..  ...()); content.add(timeField); setTitle("Clock"); setSize(100,70...) { JFrame clock = new DisplayClock(); clock.setVisible(true
Advertisements
how can create clock baisc in java
how can create clock baisc in java   think u for help me ..  ...()); content.add(timeField); setTitle("Clock"); setSize(100,70...) { JFrame clock = new DisplayClock(); clock.setVisible(true
how we can create website through java
how we can create website through java  Dear actually i wanna ask query about creation of website through java then how we can create web site through java plz help me..........i have already a web site ....specially for premium
how can create album in java by using Stack ....
how can create album in java by using Stack ....  hi all , if i press push button put the image to the stack , and when i press pop button remove the image ..??? please help me please
how can create a jar file - Java Beginners
how can create a jar file  plz any one help me which file can i create the jar file plz give exact command  Hi The basic format... that you want to create a JAR file. * The f option indicates that you want
Clock Applet in Java
Java - Clock Applet in Java       Introduction Here is a sample of running clock provided by the java applet to illustrate how to use the clock in an applet. This program shows
we can create our own header file in java?n how to create?
we can create our own header file in java?n how to create?  we can create our own header file in java?n how to create
how can i create a data grid - Java Beginners
how can i create a data grid  Nice to ur respose...thnks all of u plz help me i want make a datagrid but i have no idea about this how can i create datagrid. and how can i connect to the database plz help me give
how to build a colorful clock in JSP without using Flash.
how to build a colorful clock in JSP without using Flash.  I have to make a colorful clock using java programming or some API in a JSP page. Please send me a code for it as soon as possible
Analog clock
Analog clock  how to develope analog clock using java
How we can create a table through procedure ?
How we can create a table through procedure ?  How we can create a table through procedure
How to display mysql database records as per clock timing?
How to display mysql database records as per clock timing?  I want to display database records as per clock timing
how can i create a discussion forum?
how can i create a discussion forum?  how can i create a discussion forum for my e- mentoring site for women which can be used by a registered user only. i am using jsp and servlets and i am working with netbeans 6.8.
How can I create sessionfactory in Hibernate?
How can I create sessionfactory in Hibernate?  HELLO, How can I create sessionfactory in Hibernate? If you can explain me with example that would be great. THANKS..   Dear Friend, Here is an Example of creating
How to create a class in java
How to create a class in java  I am a beginner in programming and tried to learn how to do programming in Java. Friends please explain how can I create a class in Java
how to create notepad in java
how to create notepad in java  how to create notepad in java
java code digital clock - Java Beginners
java code digital clock  hello can you share or give me a code...://www.roseindia.net/java/example/java/applet/ClockApplet.shtml Thanks  ohhh i forget its a java program and it is using looping can you give me
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much
How to create charts in Java?
How to create charts in Java?  Is there any example of creating charts and graphs in Java? thanks   Hi, check the tutorial: Chart & Graphs Tutorials in Java Thanks
How can we create a database using PHP and mysql?
How can we create a database using PHP and mysql?  How can we create a database using PHP and mysql
how to create interfaces in java
how to create interfaces in java  HI, Here is my code public interface validateInfo { public void validate(String empcode, String password); } class updateInfo implements validateInfo { public void update() { //code
how to create reports in swing java?
how to create reports in swing java?  how to create reports in swing java
How to create first program in Java?
How to create first program in Java?  Hi, I am new in Java programming. Tell me How to create first program in Java? Thanks   Hi, Read more at First Java Program. Thanks
How can I learn Java?
How can I learn Java?  Hi, I have just completed a course in HTML... programming. How can I learn Java? in shortest possible time. I mean I just want to begin... are the best ways to learn Java for a beginner? Thanks   Hi, You can
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need...(Exception e){} } else{ System.exit(0); } } }); tp.addTab("Create Account",panel... is: bankdata CREATE TABLE `bankdata
how can i create a mysql database to connect to this code - JDBC
how can i create a mysql database to connect to this code  i need help creating a mysql database for this code. code is import java.awt....(Exception e){} } else{ System.exit(0); } } }); tp.addTab("Create Account",panel
how to create executable - Java Beginners
how to create executable  How do i create a executable file from a java file thnks in adv...!  Hi Friend, Try the following code: import java.io.*; import java.util.jar.*; public class CreateExe { public
how create package of this java code
how create package of this java code  Hi,i have email code in java which is working fine with out making package but when i want to make package of this code its stop working.Its showing exception while I execute it.I have to use
how create package of this java code
how create package of this java code  Hi,i have email code in java which is working fine with out making package but when i want to make package of this code its stop working.Its showing exception while I execute it.I have to use
java how to create visual swing editor
java how to create visual swing editor   How do I create a visual swing designer in java ?Meaning that I can "draw" a button,a JTextArea from within my designer program . I just need some basics . I've got no idea how to start
How to create new arraylist using Java
someone provides online example how to create new arraylist in java programming. thnaks,   Hi, In java programming language you can create new...How to create new arraylist using Java  hi, I want to develop
how to create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
how to create a header in jtable using java swing
how to create a header in jtable using java swing  how to create a header in jtable using java swing   d
how can you say java is secure
how can you say java is secure  we are using notepad editor for Java programming which is an Microsoft product, then how can you say Java is secure when you are using Microsoft product as an editor
how can create pop() method in this program ,Or how can delete image in it when i press pop button in runtime ??? please help me ...
how can create pop() method in this program ,Or how can delete image in it when...) JOptionPane.showMessageDialog(null," Album is Full you can not push the image ."); else...(new BorderLayout()); //Load the pet images and create an array of indexes
how to create forum on java subject in jsp/servlet ?
how to create forum on java subject in jsp/servlet ?  hi , i want to implement forum on java subject in jsp/servlet technology .how can i do it,which is the table required for it in mysql? formate like what is java is ? 2Reply
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
How a beginner can start Java Programming?
How a beginner can start Java Programming?  I Just have programming knowledge of C & C++. Let's know how I can learn Java? Is there any Java... have programming language of C and C++ then you can learn Java programming
how to create month wise serial number in java?
how to create month wise serial number in java?  Ex: For 1)January-serial number is 1/001,1/002,1/003 etc
How to Create Car Rental Application in Java ?
How to Create Car Rental Application in Java ?  Hi, How to Create a Car Renal Application using Java to Check the Car renting, booking... the car rental apps in Java
how to create unit matrix in java of arbritary dimensions
how to create unit matrix in java of arbritary dimensions  i want to create the unit matrix of arbritary dimensions say (n*m).i m a new beginner to java.someone having the program for that? help would be appreciable
I want to know how can I create sessionfactory in hibernate 4 (latest version)
I want to know how can I create sessionfactory in hibernate 4 (latest version)  Hello, I want to create sessionfactory in hibernate 4 (latest version) and I would like your help for it..An example would be of great help
how to create this diamond structure with java. - Java Beginners
how to create this diamond structure with java.   * *** ***** * *** *** * ***** * *** *** * ***** * *** *** * ***** *** *   
How to create LineDraw In Java
How to create LineDraw In Java     ... will learn how to create Line Drawing. This program  implements a line Drawing component. A java program explains the stroke line i.e. how to make thick
How to create a Java Runtime Editor - Swing AWT
How to create a Java Runtime Editor   Hi, I am working on a requirement in which I need to integrate a java runtime editor in swing application... using java swing, try the following code: import java.awt.BorderLayout
how can i simplify my java code
how can i simplify my java code  /* Create a program that prompts...=Integer.toString(f); String q=Integer.toString(g); String r=Integer.toString...); outr=k+l+m+n+o+p+q+r+s+t; return outr; //cannot return again; illegal
How to Create Circle In Java
How to Create Circle In Java     ..., you will learn how to create Circle Diagram. The java circle is the most..., you will also show that how to create square drawing. Inside the program define
 

 

 

DMCA.com