I am trying to add buttons to an already-visible jPanel. However, the following code is not working; I can't see the second button.
ja.addActionListener(new ActionListener () {
public void actionPerformed(ActionEvent e) {
klicks++;
if(klicks == 35) {
panel.add(nein);
ja.setForeground( Color.red );
frame.repaint();
panel.repaint();
}
if(klicks > 35) {
nein.setText("Beenden");
ja.setText("FAIL");
}
}});
}
Can anyone help?