如何移动到扩展JPanel的类中的其他Jpanel

时间:2015-08-19 09:09:43

标签: java swing jframe jpanel

我想转移到扩展JPanel的类中的其他JPanel。 我想从第一小组转到第二小组。我的问题:我想去secondPanelButtonActionPerformed方法中的类SecondPanel

MainMenu.java

public class MainMenu extends JFrame {

    public MainMenu() {
       FirstPanel firstPanel = new FirstPanel();
       this.setSize(500,500);
       this.add(firstPanel);
       this.setVisible(true);
    }

    public static void main(String args[]) {
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainMenu().setVisible(true);
            }
        });
    }

}

FirstPanel.java

public class FirstPanel extends JPanel {
    private void secondPanelButtonActionPerformed(java.awt.event.ActionEvent evt) {

    }
}

SecondPanel.java

public class SecondPanel extends JPanel {

}

0 个答案:

没有答案