• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

App does not work when on thread-safe in JBuilder

 
Jorge Pinho
Greenhorn
Posts: 25
MySQL Database PHP Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BTW - here is the example app from Sun's tutorial you mentioned.



You can find this file here. Hope that helps.
 
Jorge Pinho
Greenhorn
Posts: 25
MySQL Database PHP Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the notice... there was one line missing.

all working...

Jorge
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic