setLayout();l里面的c不是字符类型的,标准格式为setLayout(5,5);或setLayout(null);
CardLayout是卡片类,你已经new出来了就可以使用了,不必在使用setLayout();
使用setMargin();添加到容器中