wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes How to tell when main() is done in swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to tell when main() is done in swing" Watch "How to tell when main() is done in swing" New topic
Author

How to tell when main() is done in swing

Bobby Anderson
Ranch Hand

Joined: Oct 28, 2008
Posts: 114
So I am running into issues where I do not want to do certain things until my Frames main() method is complete. I.E. since the frame is still in an initializing state I want other function calls to behave a little differently. I know I know that is bad design but I didn't design the code and a re-design would be a nightmare at this point.

So I have some class that derives from JFrame and in it has a main to run.



So when I am doing other things once my frame is running can I call something on the MyFrame class to see if the main has completed?

If I cannot I supposed I could set a simple variable in MyFrame like isInitializing to true at the beginning of the main and set it to false at the end of my main. I just didn't know if there was something already built in, no need to reinvent the wheel.

If anyone else has any ideas on how to solve a problem like this i welcome you thoughts.

Thanks,
Billy
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

Recommended reading
http://java.sun.com/javase/6/docs/api/java/awt/doc-files/AWTThreadIssues.html
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
 
subject: How to tell when main() is done in swing
 
Similar Threads
Prompting the user whether to close the JFrame
JTable
Swing and RuntimeException
GUI problems with extending JFrame
Navigating between two JFrame in Java Swing