how can create clock baisc in java

how can create clock baisc in java

think u for help me ..

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
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
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 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 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
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for mock-clock version 1.0
com.statemachinesystems:mock-clock:1.0 Java library in your project.. Maven, Gradle, SBT, Ivy...? How to create Maven Web Application in Eclipse? Maven 3...Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for mock-clock
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 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
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 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 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
ModuleNotFoundError: No module named 'clock'
' How to remove the ModuleNotFoundError: No module named 'clock'... padas library. You can install clock python with following command: pip...ModuleNotFoundError: No module named 'clock'  Hi, My Python
ModuleNotFoundError: No module named 'clock'
' How to remove the ModuleNotFoundError: No module named 'clock'... padas library. You can install clock python with following command: pip...ModuleNotFoundError: No module named 'clock'  Hi, My Python
ModuleNotFoundError: No module named 'clock'
' How to remove the ModuleNotFoundError: No module named 'clock'... padas library. You can install clock python with following command: pip...ModuleNotFoundError: No module named 'clock'  Hi, My Python
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 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
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 reports in swing java?
how to create reports in swing java?  how to create reports in swing java
How to create and use Array in Java?
How to create and use Array in Java?  Hi, How to create and use Array in Java? Write program to construct and use the array. Thanks   Hi... can read complete example at Array in Java. Thanks
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 to create first Java Program?
How to create first Java Program?  Hi, I am beginner and I want to write first Java program. How I can setup my machine and write first Java program... and run first Java program: Create program in Note pad: Step 1: Open
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
ModuleNotFoundError: No module named 'my_clock'
_clock' How to remove the ModuleNotFoundError: No module named 'my_clock... to install padas library. You can install my_clock python with following...ModuleNotFoundError: No module named 'my_clock'  Hi, My Python
ModuleNotFoundError: No module named 'my_clock'
_clock' How to remove the ModuleNotFoundError: No module named 'my_clock... to install padas library. You can install my_clock python with following...ModuleNotFoundError: No module named 'my_clock'  Hi, My Python
ModuleNotFoundError: No module named 'my_clock'
_clock' How to remove the ModuleNotFoundError: No module named 'my_clock... to install padas library. You can install my_clock python with following...ModuleNotFoundError: No module named 'my_clock'  Hi, My Python
ModuleNotFoundError: No module named 'tomato-clock'
'tomato-clock' How to remove the ModuleNotFoundError: No module named '... environment you have to install padas library. You can install tomato-clock python...ModuleNotFoundError: No module named 'tomato-clock'  Hi, My Python
ModuleNotFoundError: No module named 'tomato-clock'
'tomato-clock' How to remove the ModuleNotFoundError: No module named '... environment you have to install padas library. You can install tomato-clock python...ModuleNotFoundError: No module named 'tomato-clock'  Hi, My Python
ModuleNotFoundError: No module named 'binary_clock'
'binary_clock' How to remove the ModuleNotFoundError: No module named '... environment you have to install padas library. You can install binary_clock python...ModuleNotFoundError: No module named 'binary_clock'  Hi, My Python
ModuleNotFoundError: No module named 'Async-Exec-Clock'
named 'Async-Exec-Clock' How to remove the ModuleNotFoundError: No module named 'Async-Exec-Clock' error? Thanks   Hi, In your...ModuleNotFoundError: No module named 'Async-Exec-Clock'  Hi, My
ModuleNotFoundError: No module named 'Async-Exec-Clock'
named 'Async-Exec-Clock' How to remove the ModuleNotFoundError: No module named 'Async-Exec-Clock' error? Thanks   Hi, In your...ModuleNotFoundError: No module named 'Async-Exec-Clock'  Hi, My
ModuleNotFoundError: No module named 'ethereum-alarm-clock-client'
: No module named 'ethereum-alarm-clock-client' How to remove.... You can install ethereum-alarm-clock-client python with following command...ModuleNotFoundError: No module named 'ethereum-alarm-clock-client'  
ModuleNotFoundError: No module named 'ethereum-alarm-clock-client'
: No module named 'ethereum-alarm-clock-client' How to remove.... You can install ethereum-alarm-clock-client python with following command...ModuleNotFoundError: No module named 'ethereum-alarm-clock-client'  
ModuleNotFoundError: No module named 'Terminal-Digital-Clock'
: No module named 'Terminal-Digital-Clock' How to remove the ModuleNotFoundError: No module named 'Terminal-Digital-Clock' error? Thanks   Hi...ModuleNotFoundError: No module named 'Terminal-Digital-Clock'  Hi
How to create custom exception in Java?
How to create custom exception in Java? In this tutorial we... custom exception class. Custom exceptions are used by Java developers to create... can create BankNotFoundException class. In this example we have explained you
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 users in LDAP using java?
how to create users in LDAP using java?  how to create users in LDAP using java
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

Ads