62,615
社区成员
发帖
与我相关
我的任务
分享
lpanel切换卡片.
public class Cmain extends JFrame {
}
public class TopJb extends JButton{
public TopJb(String string) {
super();
this.setText(string);
this.setHorizontalTextPosition(SwingConstants.CENTER);
this.setVerticalTextPosition(SwingConstants.BOTTOM);
this.addActionListener(new ActionListener() { //
@Override
public void actionPerformed(ActionEvent e) {
//这里应该怎么写?
}
});
}
CardLayout layout = new CardLayout();
JPanel container = new JPanel(layout);
container.add(component1, "C1"); // add
container.add(component2, "C2"); // add
layout.show(container, "C2"); // switch
panel2Layout.show(panel2, "do");
http://bbs.csdn.net/topics/390663968