Actually, once your swing application has been displayed, you are not allowed to access any of the components from anything that is not the event dispatching thread. With the exception of a few methods, like repaint(), it is not thread safe to do so.
Having a separate thread to handle the timing for changing the visibility is fine, but it is not allowed to directly manipulate the component. Take a look at the invokeLater() method of the SwingUtilities to dispatch that task back to the event dispatching thread.
Point p = MainFrame.getLocation(); // your main clients window. myFrame.setLocation(new Point(p.getX()+MainFrame.getLength()/2,p.getY()+MainFrame.getWidth()/2));
that would set the top left corner of your popup display message to approx. the middle of the "MainFrame".
You down with OOP? Yeah you know me!
Joined: Jan 24, 2006
well you would call the timer, then in the timer, once the message box is visible, you would just count everytime the timer is called, then you would .dispose() the message box when you are out of the counter loop, and stop the current timer.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com