• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

App does not work when on thread-safe in JBuilder

 
Greenhorn
Posts: 25
MySQL Database PHP Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the notice... there was one line missing.

all working...

Jorge
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic