Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

component for clock..  RSS feed

 
swapnel surade
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to show a current time on the screen. It should work like a digital watch...
is there any component in swing do achieve this.

thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no ready made component, but you can easily make one yourself by using JLabel and javax.swing.Timer
 
swapnel surade
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on every actionPerformed() I have to create new instance of date and set it on the JLable ??
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That would do it. You can store the DateFormat in your ActionListener subclass so you don't need to set that up. You can also store a Date object and update that:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!