I just create a program. After I click exit a "Thank You" frame will appear.
How can I make the "Thank You" frame disappear after few sec by itself without letting the user to click on X button.
How can I let a frame exit by itself after few seconds
Started by xxxxjayxxx, Aug 09 2011 05:58 AM
8 replies to this topic
#1
Posted 09 August 2011 - 05:58 AM
|
|
|
#2
Posted 09 August 2011 - 06:06 AM
use the dispose() method.
#3
Posted 09 August 2011 - 06:10 AM
ok ... I just try dispose method ... The frame closes immediately.
Is there any chance that I can set a timer ? So that when the time is up the frame will closes by itself.
Is there any chance that I can set a timer ? So that when the time is up the frame will closes by itself.
#4
Posted 09 August 2011 - 07:05 AM
TimeUnit.SECONDS.sleep(3);
#5
Posted 09 August 2011 - 08:03 AM
Editted found some errors
Edited by xxxxjayxxx, 10 August 2011 - 08:15 AM.
#6
Posted 09 August 2011 - 08:22 AM
Do the dispose after the sleep...
#7
Posted 09 August 2011 - 08:24 AM
Put the sleep-code right before your message then... currently it's at the end.
put it before:
tyFrame.setVisible(true);
put it before:
tyFrame.setVisible(true);
#8
Posted 10 August 2011 - 04:27 AM
You can use the java.awt.Robot class where you
make the robot move the mouse to the close button. Then make it
press the mouse button and release automaticaly.
e.g.
Robot r=new Robot();
r.mouseMove(x,y);//where x and y are cordinate positions of close button
r.mousePress(KeyEvent.BUTTON1_MASK);//Left mouse button
r.mouseRelease((KeyEvent.BUTTON1_MASK);
for timing use:
r.sleep(t);//where t is in milliseconds
Hope this will help
make the robot move the mouse to the close button. Then make it
press the mouse button and release automaticaly.
e.g.
Robot r=new Robot();
r.mouseMove(x,y);//where x and y are cordinate positions of close button
r.mousePress(KeyEvent.BUTTON1_MASK);//Left mouse button
r.mouseRelease((KeyEvent.BUTTON1_MASK);
for timing use:
r.sleep(t);//where t is in milliseconds
Hope this will help
#9
Posted 10 August 2011 - 10:18 AM
Kibet said:
You can use the java.awt.Robot class where you
make the robot move the mouse to the close button. Then make it
press the mouse button and release automaticaly.
e.g.
Robot r=new Robot();
r.mouseMove(x,y);//where x and y are cordinate positions of close button
r.mousePress(KeyEvent.BUTTON1_MASK);//Left mouse button
r.mouseRelease((KeyEvent.BUTTON1_MASK);
for timing use:
r.sleep(t);//where t is in milliseconds
Hope this will help
make the robot move the mouse to the close button. Then make it
press the mouse button and release automaticaly.
e.g.
Robot r=new Robot();
r.mouseMove(x,y);//where x and y are cordinate positions of close button
r.mousePress(KeyEvent.BUTTON1_MASK);//Left mouse button
r.mouseRelease((KeyEvent.BUTTON1_MASK);
for timing use:
r.sleep(t);//where t is in milliseconds
Hope this will help
Besides, it's not really user friendly to go steal their mouse.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









