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

 
 


didar sham
how can create clock baisc in java
1 Answer(s)      2 years and a month ago
Posted in : Java Beginners

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 Pages:
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
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
Text Clock
Java: Example - Text Clock This is a simple text clock. See javax.swing.Timer for an explanation of how use this simple timer class. In this example...); this.setTitle("Text Clock"); this.pack(); // Create a 1-second timer
Analog clock
Analog clock  how to develope analog clock using java
Text Clock 2
Java: Example - Text Clock 2 In this page we will show you the demo of the Text clock. We have embedded the applet in the web page for easy understanding of the code.   If you browser is Java enabled then you should
Java: Example - Buffered Analog Clock
Java: Example - Buffered Analog Clock This example show how to develop Buffered Analog Clock.   The following is an analog (uses hands... = size/2 + spacing; // Create the clock face background image
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
Extend Text Clock
Java: Example - Extend Text Clock Here are several possible extensions to Example - Text Clock 2. Minor changes. The time should be centered in the field. This can be done by calling the setHorizontalAlignment(JTextField.CENTER
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 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
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
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 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 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
create
create  how to create an excel file 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 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
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 a New File
which will demonstrate you about how to create a new file in Java...How To Create a New File In this section we will discuss about how to create a new file in Java. A Computer File is a storage of data. In this file we can
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
to create a java class and methods
to create a java class and methods  How to create a java class without using the library class to represent linked lists of integers and also provide it with methods that can be used to reverse a list & append two lists.Also
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
create dictionary in java
create dictionary in java  Hi, dear : How can create simple dictionary in java .. by using Applet or any other way like GUI (basic), please write Comment on the line that difficult to learning it .think u so much
How to Create JSP Page
How to Create JSP Page       In this section we will show you how you can create JSP page and then test... can be used. In this example I will show you how to create a simple JSP page
how can i simplify my java code
how can i simplify my java code  /* Create a program that prompts the user to enter a password. Display a suitable message for each correct or incorrect attempt made. The user must be given three tries after which
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 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 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 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 CheckBox On frame
will learn how to create CheckBox on the frame. In the Java AWT, top-level windows... can learn in very efficient manner. In this section, you will see how to create... How to create CheckBox On frame     
Create test engine - Java Beginners
Create test engine  How can create a test engine dat generates questions randomly using javax.swing in java
Create a Table - Java Beginners
Create a Table in Java  How can i create table in Java?  Java Example Code - Creating table in JAVA- - - - - - - - - - - - - - - - - - - - - - Hi, here i am giving you a java program code, that creates a table with two
how to create a login page and registration page?
how to create a login page and registration page?  hellow, pls tell me the code for how we can create a login page and registration page and how we can store the info in database.only in advance java as jsp
how to create reports in swing java?
how to create reports in swing java?  how to create reports in swing java
How to Create any type of Reports in Java - Java Beginners
How to Create any type of Reports in Java  Hello Sir ,How I can create any type of Reports like Crystal Reports etc(Student Result Report) in Java Application,plz Help Me Sir
How to create form in Swings
How to create form in Swings  How to create registration, login and question form in Java Swing?   Creating different forms in Java Swing - Examples how to create registration form in swing swing login form example
how to create a jave version excel in jsp
how to create a jave version excel in jsp  I would like to create a java version excel in JSP. so the excel like document can be published... to save the data. questions: 1 can any body share some code samples
How to create Multiple Frames using Java Swing
Multiple Frames in Java Swing In this section, you will learn how to create multiple frames. Java Swing provides the utility to show frame within another frame by providing the class JInternalFrame. With the use of this class, you can
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 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
Create a JRadioButton Component in Java
Create a JRadioButton Component in Java       In this section, you will learn how to create a radio button in java swing. Radio Button is like check box. Differences between check
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 Discussion Forum? - JSP-Servlet
How to create Discussion Forum?  Hi, Can u tell me what do you... (3.) Java (4.) Struts (5.) JSF (6.) EJB (7.) any other Technologies.... --------------------------------------- Visit for more information. http://www.roseindia.net/java
Create a Frame in Java
Create a Frame in Java       Introduction This program shows you how to create a frame in java AWT package. The frame in java works like the main window where your
how to create a queue - JMS
how to create a queue  Can u please tell me how to create q queue in JMS and also tell me how to write a program to Send a Static Message for JMS Queue ....please i need it urgently

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.