• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A Ticking Clock

 
Rajesh Chandra
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is this what you're trying to do?

 
Rajesh Chandra
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15495
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic