button1.addActionListener(new ActionListener() { @Override
public void actionPerformed(ActionEvent e) {
    ImageIcon img3= new ImageIcon(this.getClass().getResource(getRandomImage().getCardNo()+".jpg"));
m.setIcon(img3);
               for(int j=0; j<a.length;j++){
        a[j]=new JLabel();
        a[j].setText("1"+j);
System.out.println("11111111111");
pcards.add(a[j]);
        System.out.print(a[j].getText());
  }

               
}
});
为什么不能在把JLabel中的元素添加到Jpanel(pcards)中,是因为是匿名内部类才不能添加么????