File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Automatically closing windows after time

 
Jo Cook
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I just recently passed my Java Prog Cert but still consider myself a beginner since most of my work has been theoretical until now...
I am trying to build a small standalone app that pops up a frame every 30 minutes with a reminder. I have built a simple app to do that using java.util.Timer, but my problem is that I would automatically like the window to close after 1 minute if the user doesn't close it. For example if I am away from my pc for a few hours I don't want to come back and find lots of reminder windows on top of each other.
Any ideas?
Maybe I should have a single frame that automatically minimises and maximises itself instead?
Jo
 
Rob Ross
Bartender
Posts: 2205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a Timer for that as well. Start a timer when the window is set to visible. You can re-set the timer as needed whenever some activity occurs in the the window, perhaps by overriding repaint() to start a new Timer, then call the superclass version.
If the timer counts down to zero, have it invoke a method in your Frame that closes it, ie, calls dispose(), or setVisible(false), etc.
 
Jo Cook
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
duh! of course it's dispose...
Thanks Rob - can't see the wood for the trees

Jo
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic