Your problem is here:
public void asd(ActionEvent arg0) {
this.getContentPane().add(new JButton("asd"));
}
Form Container.add() javadoc:
This method changes layout-related information, and therefore, invalidates the component hierarchy. If the container has already been displayed, the hierarchy must be validated thereafter in order to display the added component.
You need to call validate()
method to make added button visible:
public void asd(ActionEvent arg0) {
this.getContentPane().add(new JButton("asd"));
this.getContentPane().validate();
}