Can't have two JFrames in different classes?
This seems like it must be a standard thing that the textbooks warn you about, but I can't find it.
All of this occurred inside Eclipse, sometimes all in the same package, sometimes not.
I wrote a very simple class which used JFrame, along with JPanel and JLabel, to open a window with some text in it. That's all. I used
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
I can run the program several times and get the same result, it opens the window properly with the text in it every time.
Then I copied everything to a new class. Other than renaming the class, and the name of the file, everything was exactly the same. But instead of opening the window, it sends some unreadable output to the console.
The original program seems to be the only one that can open windows. Is this a feature? What do I do to get different programs to have the same functionality?
Thanks.
OK, it must be an Eclipse problem
I built both files in Eclipse, but then copied them out of the workspace and deleted the "package" declaration, and byte-compiled and ran both with "javac" and "java" at the command line, and both worked fine.
This is the Eclipse that came with the Ubuntu distribution. Anyone know if it is buggy this way?