|
From: Samuele P. <pe...@in...> - 2001-10-15 23:11:05
|
[Ype Kingma]
>
> I have run into the problem that when using swing it is necessary
> to call java.lang.System.exit() to exit the process running the
> jython interpreter.
That's always true but from my point of view it's a sensible
behaviour wrt to the thread based vs. loop based model
used by Java GUIs. (I know it can be annoying if one uses
only some input dialogs for instance )
But it's inherited from pure Java GUI code, try:
import javax.swing.*;
public class JB {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JButton b = new JButton("Ok");
f.getContentPane().add(b);
f.pack();
f.show();
}
}
or
import javax.swing.*;
public class JOP {
public static void main(String[] args) {
int result = JOptionPane.showConfirmDialog(null,
"Will an answer leave the app?", "?",
JOptionPane.YES_NO_OPTION);
}
}
Otherwise one would have to put some unnatural wait
or loop in the main thread.
regards.
|