• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

update problem

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about invoking the repaint() method?
 
Shay Gaghe
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im sorry , above is the code:
thanks
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chantal, That would be too easy
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh, I'm so sorry. I'll shut up, next time. (s... I know I won't be able)
chantal
 
Shay Gaghe
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you both for your fantastic kindness
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic