JOptionPane makes it easy to pop up a standard dialog box that prompts
users for a value or informs them of something.
JOptionPane's showConfirmDialog() asks a confirming question, like yes/no/cancel. Visit a sample tutorial here which demonstrates how it can be used.
A Sample Example :-
// f = new File(filePath);
// filePath is of type String and stores location of the file.
int dialogButton=JOptionPane.YES_NO_OPTION;
int dialogResult=JOptionPane.showConfirmDialog(null,"Would you like to uninstall this application(Press Yes to delete OR No to quit)???","Confirm Action", dialogButton);
if(dialogResult==JOptionPane.YES_OPTION)
f.delete();
else
{
FinalLabel.setText("File Uninstallation process cancelled...");
try {
Thread.currentThread().wait(2000);
} catch (InterruptedException ex) {
System.exit(0);
}
}
So, you may try to use this in your standalone Java application.