any builtin classes available to display the digital clock in java??
+2
A:
i dont think there are any built in, but they are pretty easy to develop. there is a swing timer utility that you can use. here is a demo
akf
2009-06-26 05:02:17
thank u!! its a good example
2009-06-26 05:04:58
A:
No, not that I'm aware of.
However, assuming the use of Swing, one could use the JLabel
class or the like use its setText
method to show display the current time. (Another option is to extend the JLabel
to display the current time as well.)
If one needs to actually make a subclass of JComponent
which displays a seven-segment digit-like display by writing a custom paintComponent
method to draw the digits.
coobird
2009-06-26 05:02:37
A:
You can print the date and time with
System.out.println(new java.util.Date());
Thorbjørn Ravn Andersen
2009-06-26 08:14:29