Как изменить панели макета карты с другой панели?

Я много погуглил, но решений не нашел. Думаю, мне помогут мастера java ...

Это мой метод инициализации:


private void initialize() {
    this.setSize(750, 480);
    this.setContentPane(getJContentPane());
    this.setTitle("Registration");
    JPanel topPane = new TopPane();
    this.getContentPane().add(topPane,BorderLayout.PAGE_START);
    cards=new JPanel(new CardLayout());
    cards.add(step0(),"step0");
    cards.add(step1(),"step1");
    cards.add(step2(),"step2");
    this.getContentPane().add(cards,BorderLayout.CENTER);
}

public JPanel step2(){
    EnumMap<DPFPFingerIndex,DPFPTemplate> template = new EnumMap<DPFPFingerIndex, DPFPTemplate>(DPFPFingerIndex.class); 
    JPanel enrol = new Enrollment(template,2);
    return enrol;
}

public JPanel step0(){
    JPanel userAgree = new UserAgreement();
    return userAgree;
}

public JPanel step1(){
    JPanel userInfo = new UserInformation();
    return userInfo;
}

public JPanel getCards(){
    return cards;
}


Это метод на другом шаге0 JPanel:

jButtonAgree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                Registration reg = new Registration();
                LayoutManager cards = reg.getCards().getLayout();
                ((CardLayout) cards).show(reg.getCards(),"step1");
            }
        });

Никакой реакции, я пробовал перепроверить, перерисовать и другой персонал ... не работает ... здесь ни у кого есть еда!

11
задан M. Tibbits 18 August 2011 в 13:57
поделиться