• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
please help me
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • 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
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitesh Panchal wrote:please help me

http://faq.javaranch.com/java/PatienceIsAVirtue
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!