Two Laptop Bag
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 Java Interview Guide this week in the Jobs Discussion 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

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.

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10836

Recommended reading

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: How to tell when main() is done in swing
It's not a secret anymore!