File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes App does not work when on thread-safe in JBuilder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "App does not work when on thread-safe in JBuilder" Watch "App does not work when on thread-safe in JBuilder" New topic
Author

App does not work when on thread-safe in JBuilder

Jorge Pinho
Greenhorn

Joined: May 16, 2003
Posts: 25

Hi all

I have this little piece of code (JBuilder 2005):
====================================
public class myclass {
private static void showMain() {
MainFrame mainWin = new MainFrame();

mainWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainWin.setSize(500, 300);
mainWin.setResizable(false);
mainWin.show();
}

public static void main(String[] args) {
Runnable runSirios = new Runnable() {
public void run() {
showMain();
}
};

System.out.println("app end...");
}
}
====================================

everything compiles fine, but nothing happens. If I move the
showMain();
to outside the Runnable class it works fine. I am doing a call to a JFrame in the way that the "Sun JFC/Swing tutorial" recomends.

any help why this piece of code doesn�t work ?


Jorge Pinho / SCJP 5
Live Help via Skype - lets.talk.about.help
Dont wait for forum answers
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Originally posted by Jorge Pinho:
I am doing a call to a JFrame in the way that the "Sun JFC/Swing tutorial" recomends.


Actually, you aren't. You main should look similar to this:



GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

BTW - here is the example app from Sun's tutorial you mentioned.



You can find this file here. Hope that helps.
Jorge Pinho
Greenhorn

Joined: May 16, 2003
Posts: 25

thanks for the notice... there was one line missing.

all working...

Jorge
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: App does not work when on thread-safe in JBuilder