Netbeans JFrame initialization; build is fine, but no window is made

dhruv

New Member
I'm using Java, and I am trying to create a GUI with NetBeans. I've done this before, and I'm very puzzled because my code, while NetBeans doesn't give errors, will not produce a new JFrame window when I run it in NetBeans. However, the code that initializes the JFrame is essentially identical to my previous GUI-possessing program ("program one"). When I try running "program one", it works just fine. Here is my problem code;\[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);}}\[/code\]According to NetBeans, the build always goes fine, but as I said, no actual window is produced. What am I doing wrong?Side note; ignore my gratuitous import list.
 
Back
Top