• 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

help needed on clearing concept regarding javax.swing.Timer.

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am not able to understand the concept of Timer. Say suppose

1) i extends JFrame and create my own frame object
2) i extends JPanel and create my own panel object
3) in frame object's constructor i create a panel's object
4) in panel object's constructor i create a Timer class's object and perform slideshow
5) after some time ( say when index reaches to 5 i stop timer using timerObj.kill() )
6) when this timer stops i want the panel object to be removed from frame. This means i need
to write some code in frame object's constructor that will wait till the timer is running and when it is stopped i would say remove(panelObject). But how to do this??

Thanks in advance !
 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please help me
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you do this
> 5) after some time ( say when index reaches to 5 i stop timer using timerObj.kill() )

you include code to also remove the panel from the frame, then validate()/repaint() the frame
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nitesh Panchal wrote:please help me


http://faq.javaranch.com/java/PatienceIsAVirtue
 
reply
    Bookmark Topic Watch Topic
  • New Topic