PulsePanda
PulsePanda

Reputation: 1856

How do i make a netbean's GUI pop up when i run it

When i make a GUI on netbeans, and i hit run on the top, nothing happens. it just says "build successful". i dont know how to make it do this. any help would be great! thanks

ps: i've googled it and I cant find anything on the subject.

pss: i just remembered. i saw onetime when i was at a friends house, he has the same problem. all he had to do was add a code somewhere to make it pop up. idk what or how, but thats what i remember. idk if it will help though.

Upvotes: 0

Views: 4707

Answers (3)

daniel gratzer
daniel gratzer

Reputation: 53901

Alternatively, you can create an instance of your GUI (let's say it's called, GUIDemo) in your main class and then you set it visible. You'd do this like this:

GUIDemo gui = new GUIDemo();
gui.setVisible(true);

Note that not all versions of Netbeans automatically create that constructor, you would have to write it yourself. In the source code for GUIDemo, you'd add this constructor:

public GUIDemo()
{
    initComponents();
}

Upvotes: 1

PulsePanda
PulsePanda

Reputation: 1856

I figured it out. all i needed to do was delete the current main class which was a useless .java file and set my main class as the jframe file! thanks for the help though

Upvotes: 0

prasun
prasun

Reputation: 63

It may be happened that your main project setup was not correct.Right click your project from left side project explorer pane and select set as main project.

Upvotes: 0

Related Questions