我有一个面板,里面有两个表格。第一个表单中有按钮。单击表单1中的按钮应显示form2。
我为按钮编写了一个处理函数 var a = Ext.getCmp('mainpanel'); //它是面板的id a.setActiveItem(Ext.getCmp( 'subform2')); //它是第二种形式的id
请帮帮我
答案 0 :(得分:0)
尝试创建一个分层面板,然后添加2个面板
private JLayeredPane mainPanel = new JLayeredPane();
private JPanel form1Panel = new JPanel();
private JPanel form2Panel = new JPanel();
//other settings on the panel ...
//your form...
//on form1 button
JButton button1 = new JButton("go to form 2");
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
form1Panel.setVisible(false);
form2Panel.setVisible(true);
}
});
form1Panel.add(button1);
mainPanel.add(form1Panel);
mainPanel.add(form2Panel);