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?
Trouble starting Swing app
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Re: Trouble starting Swing app
I've had this problem before (just about as annoying as the Nortons bug/feature). My resolution was to just never run Swing apps from textpad. Not the most elegant solution, I'll grant you.
Surely this is a sign of a process or thread related bug, but one can't be sure without further testing.
Surely this is a sign of a process or thread related bug, but one can't be sure without further testing.
Re: Trouble starting Swing app
I have been working through Deitel&Deitel's book, "Java 2 - Introducing Swing". I have only had one minor bit of weirdness which I will mention later.
In looking at your code:
javax.swing.*;
public class HelloWorldSwing {
public static void main(String ...
I think you need an "import" keyword, before the javax.swing.*
import javax.swing.*;
public class HelloWorldSwing {
public static void main(String ...
Dano
In looking at your code:
javax.swing.*;
public class HelloWorldSwing {
public static void main(String ...
I think you need an "import" keyword, before the javax.swing.*
import javax.swing.*;
public class HelloWorldSwing {
public static void main(String ...
Dano