Forums Register Login

App does not work when on thread-safe in JBuilder

+Pie Number of slices to send: Send
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 ?
+Pie Number of slices to send: Send
 

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:

+Pie Number of slices to send: Send
BTW - here is the example app from Sun's tutorial you mentioned.



You can find this file here. Hope that helps.
+Pie Number of slices to send: Send
thanks for the notice... there was one line missing.

all working...

Jorge
rubbery bacon. crispy tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1196 times.
Similar Threads
Why doesn't this inner class compile under Java 6?
SWT new Threads don't terminated upon disposal?
resize ?
Thread class constructor
JQPlus Question on Inner Classes
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:19:30.