0

I know there are several questions about this, just i cant see the solution for my problem.

My problem is the same like this: How to stop Java from running the entire code with out waiting for Gui input from The user

The program does not wait for the >details to be entered it just initializes the Gui class and simply continues

Whit Netbeans IDE i create a gui for parsing arguments, that have manny text fields and one button.

enter image description here

The method of the button "Traducir" is:

private void jButtonTraducirActionPerformed(java.awt.event.ActionEvent evt) {                                                
    // I put the entries in attributes.

    documento = this.pathDocumento.getText();
    salida    = this.pathSalida.getText();
    ignoradas = this.pathIgnoradas.getText();
    diccionarioDefecto = this.pathDiccionarioDefecto.getText();
    diccionarioUser = this.pathDiccionarioUser.getText();
    implementacion = this.pathImplementacion.getText();
    reverseLocal = this.buttonReverse.isSelected();

    // here I would have to do an notifyAll()      
}

I have a class Main that call this:

    menuPrincipal parsing = new menuPrincipal();
    parsing.main(null);

    // here I would have to do a whait()

For do whait() and notifyAll(), i have to put in a Synchronization context, but what synchronize? How do i do?

Community
  • 1
  • 1
NahuelBrandan
  • 633
  • 6
  • 16
  • 1
    This should probably be a dialog box rather than a frame, then. – RealSkeptic Nov 29 '16 at 17:01
  • Ho, ok, so is more easy leave this and doit whit dialog box that think in synchronization – NahuelBrandan Nov 29 '16 at 17:08
  • 1
    It simply has nothing to do with synchronization. By default, GUI works in its own thread and runs the event listeners when events happen, and it has nothing do do with the main thread. You have nothing to synchronize on or with. A dialog box is used for the concept of running a program, stopping for user input, then continuing with the program. – RealSkeptic Nov 29 '16 at 17:12
  • Perfect, You were very clear. Thanks. – NahuelBrandan Nov 29 '16 at 17:14

0 Answers0