PDA

View Full Version : Swing is being evil...


ImEric12
08-08-2002, 10:49 PM
I got all the Java components working.. EXCEPT SWING! I have javax\swing in the src folder with all the other imported components.. why wont it work?

descapa
08-11-2002, 02:05 PM
I am not sure what you are trying to do but I know the following bit of code should work, so please try and test this out:
--------------------
import javax.swing.*;

public class HelloWorld {

static public void main(String[] arg) {

JFrame jf = new JFrame("Hello World");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setSize(300,300);
jf.show();
}

}
---------------------------------

Also you need to make sure you have a more recent version of the JDK. If you have an old version it might not work, I think you need version 1.2 or higher.

I hope this helps...please post anyother question if you have one.