I have a dialog for a client-GUI that asks for the IP and Port of the server one wants to connect to. I have everything else, but how would I make it so that when the user c
Good solutions. If you want not to use something else, this is a working example: 1) set DO_NOTHING_ON_CLOSE to ensure user MUST press OK 2) verify if the JDialog is still visible.
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.setModal(false);
dialog.setVisible(true);
dialog.setAlwaysOnTop(true);
while(dialog.isVisible())try{Thread.sleep(50);}
catch(InterruptedException e){}
This can be a solution if you want to implement a non-modal dialog box.