I am not able to view the labels which are created dynamically.The code is as follows :
JLabel[] labels = new javax.swing.JLabel[cur.length];
for (int i = 0 ;i < cur.length; i++)
{
System.out.println("in");
labels[i] = new JLabel( cur[i] );
labels[i].setText(""+cur[i]);
jPanel1.add(labels[i]);
this.setVisible(true);
}
}
There can one or many of cause for your problem
1. Your JPanel may not be added to Container. Add it using getContentPane().add(jpanel1);
2. Your JLabel itself are not visible. Set their visible property to true.
3. Your JPanel is not having flowlayout but CardLayout and hence they might be visible in the back of other component. Assign the layout using jpanel1.setLayout(new FlowLayout())
4. Shift your this.setVisible(true) to outside loop.