aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes update problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "update problem" Watch "update problem" New topic
Author

update problem

Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
Hi
I have to include Clock within my GUI so I tried to make one. This clock working fine but its look like its not update() itself , I looked at the API and I know that Swing don�t use update() like AWT does , I have to deal whit the UI Delegate , can anyone help me to provide update() like functionality in swing based container?

thanks
Shay Gaghe

[This message has been edited by Shay Gaghe (edited October 25, 2001).]
Thomas Suer
Ranch Hand

Joined: Sep 03, 2001
Posts: 50
What about invoking the repaint() method?
Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
Im sorry , above is the code:
thanks
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Three changes:
Change the paintComponent method to paint. Change the Frame to JFrame (don't mix awt and swing). Change the add to frame.getContentPane().add(). There is a problem with overlaying of the time but at least it gives you a start.
You could use the clearRect() method of Graphics.
[This message has been edited by Paul Stevens (edited October 25, 2001).]
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
why not just add a JLabel to the JPanel, showing the time? the setText() mehtod of JLabel is Thread safe.
(sorry, I just don't understand why you're using the paint methods in this case. if you want a special font or background, that's no problem with JLabel.)
chantal
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Chantal, That would be too easy
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
oh, I'm so sorry. I'll shut up, next time. (s... I know I won't be able)
chantal
Shay Gaghe
Ranch Hand

Joined: Sep 03, 2001
Posts: 102
thank you both for your fantastic kindness
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: update problem
 
Similar Threads
how do you create an java alarm clock with audio?
How to create an Java Alarm clock with audio?
How do you create an java alarm clock with audio??
Problem on extending an extended class
how do you create an java alarm clock with audio?