I created a GUI (called ParameterUI) with the Netbeans GUI Builder and now I want to create an instance of it and display it. However, using
ParameterUI gui = new ParameterUI();
gui.setVisible(true);
doesn't cause any window to appear... Testing shows that after those commands, gui.isVisible() returns true, but gui.isValid() is false. Calling gui.revalidate() has no effect either.
In the ParameterUI class, the constructor method is generated by Netbeans and is simply
public class ParameterUI extends javax.swing.JPanel {
public ParameterUI() {
initComponents();
}
}
initComponents is simply a listing of where each jPanel etc. will be placed.
The strange thing is that when I made a practice GUI with the tutorial at http://netbeans.org/kb/docs/java/gui-functionality.html , the GUI was set as the main class despite having no main method and the GUI appeared of its own accord.
Unfortunately I'm a novice with GUIs (I'm using the builder cause I haven't got time to learn how to make a proper hand-made GUI), but can someone tell me how to make my GUI visible? I can provide more code if necessary...
EDIT: I tried
JFrame window = new JFrame();
ParameterUI gui = new ParameterUI();
window.setContentPane(gui);
window.pack();
window.setVisible(true);
having read a short tutorial on JFrames, but it doesn't seem to change anything...