tags:

views:

209

answers:

5

Hello, I am new using java and netbeans. I want to make a swing gui, and I already followed this step (http://www.netbeans.org/kb/60/java/quickstart-gui.html#top) but when I run this, nothing happens and I don't see anything.

What should I fill in here?

public void main (string args[]) {

    ???????????????

}
A: 

This is the entry point into the application, or the first thing called by Java to start your application. You should possibly create a new instance of your class here. I see it's called ContactEditor so if you've named it this you should be able to do:

ContactEditor contactEditor = new ContactEditor();

After this you might need to call a method within that class, but I can't help you anymore than this unless you post the source code you currently have.

Jon
A: 

Maybe you should start here: http://www.netbeans.org/kb/docs/java/quickstart.html

Esko Luontola
A: 

nothing happens -> probably Netbeans is indicating an error somewhere near the "??????????" (I don't use Netbenas).
First, there are some errors in your code:

  • main must be static
  • String is with an uppercase S

I would sugest to start with a simple Hello World (kind of):

public static void main(String args[]) {
    System.out.println("Papaa");
}

if this works - print "Papaa" on the console - you can go on creating an instance of your class.

Carlos Heuberger
+1  A: 

If you have followed the instructions in the linked tutorial, this project should not have a Main class. In Step 5. of the Create a Project step you should have cleared the Create Main Class check box.

Ensure that the Set as Main Project checkbox is selected and clear the Create Main Class field.

I suggest that you restart the tutorial and try again. Good Luck.

Coxy
+1  A: 

This is pretty common. Under the creating a project page, there is a step which is commonly missed which says, Ensure that the Set as Main Project checkbox is selected and clear the Create Main Class field.

Reason: If you don't follow this step, the program will compile correctly, however you won't get the window appearing because the program is happily executing the main class and then exiting.

Fix: You can fix this up by simply deleting the Main.java class by right hand clicking on the item, and then delete. If you recompile the program, you will be prompted with a dialog asking to set CelsiusConverterGUI as the main class for this project, as described in the tutorial.

Glen