How can I add multiple labels to a frame when button pressed. I have a frame with some controls and I want to add some ("n" - number inserted by user in "textField") labels when "but" button is pressed.
My code is:
public class SwingDemo extends JFrame
{
protected static final JLabel[] JLabel = null;
static JLabel filozof1;
static JTextArea rezultat;
static JTextField textField;
static JButton but;
static JFrame frame;
public void start()
{
    frame = new JFrame("Filozofi chinezi");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(null);
    JLabel label = new JLabel("Numar folozofi :");
    label.setBounds(20, 20, 100, 20);
    filozof1=new JLabel();
    filozof1.setBounds(124, 50, 100, 20);
    rezultat=new JTextArea();
    rezultat.setBounds(50, 200, 700, 400);
    rezultat.setLineWrap(true);
    textField = new JTextField(2);
    textField.setBounds(124, 20, 100, 20);
    but=new JButton();
    but.setText("Start");
    but.setBounds(280, 20, 70, 20);
    frame.add(label);
    frame.add(filozof1);
    frame.add(rezultat);
    frame.add(textField);
    frame.add(but);
    frame.setSize(800,700);
    frame.setVisible(true);
}
public static void main(String args[])
{ 
    new SwingDemo().start();
    filozof1.setText("");
    rezultat.setText("");
    but.addActionListener(new ActionListener(){
                  public void actionPerformed( ActionEvent e){ 
                       Filozof[] F; int i; 
                       JLabel[] labels;
                       filozof1.setText("Button clicked");
                       n = Integer.parseInt(textField.getText());
                       labels= new JLabel[n];
                       for(i=0; i<n; i++) labels[i] = new JLabel("i");
                       for(i=0; i<n; i++) labels[i].setBounds(0, 0, 10, 10);
                       for(i=0; i<n; i++) labels.frame.add(eticheta[i]);}});
    }
}
 
     
    
