This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes A Ticking Clock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "A Ticking Clock" Watch "A Ticking Clock" New topic
Author

A Ticking Clock

Rajesh Chandra
Ranch Hand

Joined: Jun 13, 2005
Posts: 55
Hi friends,
im out to make a ticking clock (console based).With Calendar class and Date class in java.util ,can we get the time(ie hours, minutes and seconds separately??).if we manage to get these data is it possible to show it in the console with the clock updating itself dynamically?
In nutshell is it possible to make a clock like we have in our computers at the bottom right.
regs
Rajesh
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3418
    
  12
Read the API

As far as displaying it in the console is concerned, I assume you want each update to overwrite the previous one rather than be on a new line each time. If so then you need a way to manipulate the cursor position. This isn't possible in standard Java, but I believe there is a package called JCurses or JavaCurses that may do this for you.


Joanne
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
is this what you're trying to do?

Rajesh Chandra
Ranch Hand

Joined: Jun 13, 2005
Posts: 55
Thank u so much. It is exactly what i wanted.Can u explain it in detail how it works?
regs
rajesh
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Rajesh,

It's a very simple program, it's not hard to understand.

You really need to have a good look at the API documentation. Lookup the classes and interfaces used in the code (such as java.text.SimpleDateFormat and java.util.Timer) in the documentation and read about how they work.

Please do some work yourself instead of expecting that someone will explain every little detail for you - if you find out for yourself, you'll learn more.

If you don't fully understand the basics of the Java language yet (classes, interfaces, methods, loops, etc.), have a look at The Java Tutorial.
[ September 29, 2005: Message edited by: Jesper de Jong ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A Ticking Clock
 
Similar Threads
a more advanced example of JavaFX
Is this sentence right?
Normal to be scared of this test?
can we have a short break while taking the beta exam?
anyone good at math?