I have an application that I want to create my own dialog screens. For example, the user cliks on one frame, and I want to open a window for the user to enter data, after the user finishes, he presses OK and then the main app continues.
On the class that I open the dialog, I open it with:
NewOkCancelDialog.abrePopup();
System.out.println("Program should wait for the dialog to close");
And the 'NewOkCancelDialog' class is defined like:
public class NewOkCancelDialog extends javax.swing.JDialog {
The constructor is like:
public NewOkCancelDialog(java.awt.Frame parent, boolean modal) {
super(parent, true);
initComponents();
this.setLocation(400,400);
}
This methods are when the user activates the button and the popup closes..
private void cierraPopupOk(){
resultados.setciudad1(this.fld_ciudad1.getText());
if (resultados.getciudad1length() < 3) {
System.out.println("Error en la entrada!");
} else {
doClose(RET_OK);
}
}
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
cierraPopupOk();
}
private void doClose(int retStatus) {
returnStatus = retStatus;
this.estaAbierto = false;
setVisible(false);
dispose();
}
I would like to have the application in the first lines, after calling
NewOkCancelDialog.abrePopup();
to wait until the method doClose() in NewOkCancelDialog class is finnished. But right now, after the ...abrePopup() is called, it continues.
What am I doing wrong? or what am I not doing?