Jlabel array not showing up in netbeans when dynamically created

I cannot view shortcuts 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);
   }
 }
+5
source share
2 answers


1. JPanel . getContentPane(). Add (jpanel1);
2. JLabel . true. 3. JPanel flowlayout, CardLayout , , . jpanel1.setLayout( FlowLayout())
4. this.setVisible(true) .

+4

jPanel? , , FlowLayout. , , .

0

All Articles