javaSwing 怎么实现点击按钮显示对应的界面

新手小白求解答 比如登录是登录界面.注册是注册界面求大神指教

给按钮添加动作监听器,然后让点击按钮的这个动作弹出对话框出来

                JFrame frame = new JFrame("事件");
        JButton button = new JButton("点击");
        frame.add(button);
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                JFrame frame1 = new JFrame("新窗口");
                frame1.setVisible(true);
                frame1.setSize(100,200);
            }
        });
        frame.setVisible(true);
        frame.setSize(400,500);

MyDialog d =new MyDialog();
d.setVisible(true);
不同的按钮弹出不同的对话框

怎样让他跳转到指定的页面呢