To display a jop
you don’t need to instantiate it, just write
JOptionPane.showMessageDialog(null, "Digite o código abaixo e clique em 'Solicitar Certidão' aguarde retorno da consulta, pressione OK nesta janela e o processo seguinte será automatizado", "Atenção", JOptionPane.WARNING_MESSAGE);
Another detail that can help you is instantiating a jDialog in your main frame.
Jdialog will pause the execution of your frame, until the jdialog itself receives some closing event (e.g., Dispose()), then it will return to its frame.
In Netbeans you have the option to create a jDialog (wherever you go to create classes etc.. ) and this dialog already comes with all the events and everything else created, greatly facilitating the manipulation of the same. It is like a frame, can be made checks and everything else inside it (because it is a class like all other things), this can be useful since from what I understand you need to open this jdialog for the user to fill a captcha, and then if right return to the main frame (I think that’s it).
additionally within the jDialog itself you could create get to receive methods in the frame if the user chooses to close the dialog without completing the captcha..
something like..
CaptchaDialog cap = new CaptchaDialog(null,true);
cap.setVisible(true);
if (!cap.getValidacao){
//o usuario optou por fechar o dialog sem conluir o captcha
}else{
//o usuario acertou o captcha
}
I only created the dialog because I needed setAlwaysOnTop method that is not applicable in Joptionpane.
– Douglas Sena