RoR
RoR

Reputation: 16502

Java Jframe Not showing up

I have a question. I created a new project with netbeans and have main.java and i created a jframe that i called GUI.java. Now when I hit F6, my GUI.java dosen't appear and it runs but nothing shows up cause my main is empty. But if i right click on GUI.java, it shows up the jframe.

How do I go about getting my Jframe working properly to show up when I hit F6?

Thanks in advance.

Upvotes: 2

Views: 3438

Answers (2)

user466784
user466784

Reputation:

Also, if you instantiate the JFrame from your main class, you'll need to set this.setVisible(true) in the JFrame constructor

Upvotes: 1

trashgod
trashgod

Reputation: 205885

The easiest approach is to customize the <default config> combo box and choose your preferred Main Class. Alternatively, you can put your GUI in a JPanel and add() it to a manually created JFrame, as shown in this example.

Upvotes: 1

Related Questions