Trouble starting Swing app
Posted: Sat Feb 16, 2002 6:52 pm
I have a Swing application which I can run just fine from the command line. I can also run a text-only version of it from TextPad. But when I try to run the Swing version, it gets to where it tries to do the setVisible(true) and it just hangs. I have to close TextPad to make it stop.
I even have the problem when I try to run java.sun.com's "First Swing Program":
javax.swing.*;
public class HelloWorldSwing {
public static void main(String[] args) {
JFrame frame = new JFrame("HelloWorldSwing");
final JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
It just hangs. Any idea why?
I even have the problem when I try to run java.sun.com's "First Swing Program":
javax.swing.*;
public class HelloWorldSwing {
public static void main(String[] args) {
JFrame frame = new JFrame("HelloWorldSwing");
final JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
It just hangs. Any idea why?