[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 405
  • Last Modified:

Timed Jpanel Popup

I'm looking to make a Jpanel (or JDialog) that will popup for around 3 seconds displaying some text that it is given and then dissapear without any user interaction.

I am able to make a panel that will appear as a popup, but I am unable to figure out how to get the panel to close on it's own after a certain period of time.
0
FutureTechWest
Asked:
FutureTechWest
  • 2
1 Solution
 
sciuriwareCommented:
You can set a timer and    panel.dispose()   on it.
But what you describe ... could be a tooltip.

;JOOP!
0
 
StillUnAwareCommented:
You can use javax.swing.Timer to achieve this behaviour:

final JDialog jd = ...
ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
        jd.dispose();
    }
};
Timer t = new Timer(3000, al);

after creating dialog and timer, show the dialog and start the timer:

jd.setVisible(true);
t.start();
0
 
StillUnAwareCommented:
glad to help
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now