I want to close a JOptionPane after passed some time, i have tried with dispose(), hide(), and using the command getRootPane().dispose() with no results.
I want to close it after 3 seconds or more so the user don't need to press the button at any time the JOptionPane emerges.
                        
You can use one of these statements to hide/close the JFrame.
or
i.e.