I have the following:
JButton btnSalir = new JButton("Volver");
btnSalir.setBounds(469, 674, 89, 23);
btnSalir.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Administrador Admin = new Administrador();
Admin.setVisible(true);
ModificarEmpleados.this.dispose();
setVisible(false);
}
});
contentPane.add(btnSalir);
This works for me and returns to the administrator window, the issue is that I need it, if you open it from the administrator window, return to administrator, as it does, but if you open it from the operator window, go back to the operator without leaving to go to the administrator.