Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply 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: 8436

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


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to tell when main() is done in swing
 
Similar Threads
GUI problems with extending JFrame
Navigating between two JFrame in Java Swing
JTable
Swing and RuntimeException
Prompting the user whether to close the JFrame