Java – NetBeans JFrame initialization; The build is good, but there is no window
I'm using Java and I'm trying to create a GUI using NetBeans I've done this before. I'm confused because my code doesn't give errors, but when I run it in NetBeans, it won't produce a new JFrame window However, the code for initializing JFrame is basically the same as my previous GUI owner ("program 1") When I tried to run program one, it worked well This is my question code;
package aircannoncalculator;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class CalcGUI extends JFrame {
public CalcGUI(){
setTitle("Air Cannon Modeler");
setSize(400,400);
setLocationRelativeTo(null);
setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args){
CalcGUI gui = new CalcGUI();
gui.setVisible(true);
}
}
According to NetBeans, builds are always good, but as I said, no actual windows are generated What on earth did I do wrong?
Side note; Ignore my free import list
Solution
You must set JFrame as the main class of the project Right click the project name (coffee cup icon) – > setting configuration – > customization – > in the "run" section, click the "Browse" button on the right side of "main class:", select the default main class (JFrame you want), and finish!
