0

Hello community of Stackoverflow, my doubt is the following one I will see I am registering a sale for it I need the data of the client (this in a window). I consult in my database if the client is registered or not, if it is not registered I show a window with the registration option, to register the client. The issue is that all the method I had in the first window is still running.

What I want is that if I go to the registration window, the execution flow (to call it somehow) goes to that window and then returns to the main window (of the sale).

FRAME CODE:

clientevo ocliente =null; for (int i = 0; i < mdlclientes.lclientes.size(); i++) {

    if (mdlclientes.lclientes.get(i).getNombre().toUpperCase().equals(cliente.toUpperCase())) {
        ocliente=new clientevo();
        ocliente = mdlclientes.lclientes.get(i);
    }
} 
if (ocliente==null) {
   JOptionPane.showMessageDialog(null, "register the client");
   frmclienteregistro ofrmcliente=new frmclienteregistro();
   ofrmcliente.setVisible(true);
   ocliente=new clientevo();
   ocliente=ofrmcliente.crearcliente();

}
return ocliente;
  • 1
    Personally, I think you need a slightly different work flow, one which checks to see if the user is registered or not before embarking on a workflow which requires them to be registered. How ever, you will most likely to want to look at [How to Make Dialogs](https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html) - the basic answer to your question is - you want a modal dialog – MadProgrammer Apr 26 '18 at 20:16
  • This is what I do : Enter a customer id and verify if it exists in the database. If it does NOT exist, the window to register is displayed and after recording the return to the window that was at the beginning – paul zapata Apr 26 '18 at 20:28
  • 1
    Use a modal dialog - it will return, automatically, to the point that it was made visible after the dialog is closed - that's point – MadProgrammer Apr 26 '18 at 20:31
  • See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) – Andrew Thompson Apr 27 '18 at 01:16

0 Answers0