I'm trying to create my first UI with netbeans. What I ultimately want to do is create something that will show a fairly arbitrary number of fields depending on certain variables but to begin with I'm simply trying to add a new component (or a number of new components) in response to a button being pressed. Here is my event handler:
public void newProjectSetup()
{
javax.swing.JButton newThing = new javax.swing.JButton("test");
getContentPane().add(newThing, "card2");
validate();
pack();
System.out.println("NewProjectSetup activated");
}
This event handler is definitely firing in response to my pressing the relevant button, but the button "newThing" is not appearing. I'm creating the rest of my GUI with the netbeans GUI builder and have tried my best to copy the code from there, thinking that would work. I'd appreciate any help.