frame 2 inside frame 1
I have 2 classes; Students and RegisterStudents, and hence 2 different main_panel(Class 1) and panel_1 (Class 2). What I am trying to do is, when a button on the Students Interface is pressed, the whole panel_1 should appear within main_panel. I have set both to same size already. is that possible? The code i got so far is: JButton btnNewButton = new JButton("Register Student"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { Students main_panel = new Students(); RegisterStudent panel_1 = new RegisterStudent(); main_panel.add(panel_1); }