Java Utililty Methods JOptionPane Prompt

List of utility methods to do JOptionPane Prompt

Description

The list of methods to do JOptionPane Prompt are organized into topic(s).

Method

intaskYesNo(String title, String prompt, Object... args)
ask Yes No
return JOptionPane.showConfirmDialog(getFrontWindow(), String.format(prompt, args), title,
        JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
FilepromptForDatsDir(Component parentComponent)
Modally prompts the user for the FTL resources dir.
File result = null;
String message = "";
message += "You will now be prompted to locate FTL manually.\n";
message += "Select '(FTL dir)/resources/data.dat'.\n";
message += "Or 'FTL.app', if you're on OSX.";
JOptionPane.showMessageDialog(parentComponent, message, "Find FTL", JOptionPane.INFORMATION_MESSAGE);
final JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Find data.dat or FTL.app");
...
StringpromptForDecryptionPassword()
prompt For Decryption Password
JPanel decryptionPasswordInputPanel = new JPanel(new GridLayout(1, 2));
JPasswordField decryptionPasswordPrompt = new JPasswordField();
decryptionPasswordInputPanel.add(new JLabel("Enter decryption password:"));
decryptionPasswordInputPanel.add(decryptionPasswordPrompt);
int result = JOptionPane.showConfirmDialog(null, decryptionPasswordInputPanel, "Decryption Password",
        JOptionPane.OK_CANCEL_OPTION);
if (result == JOptionPane.OK_OPTION) { 
    return new String(decryptionPasswordPrompt.getPassword());
...
booleanpromptForDelete(Component c, String title, String prompt)
prompt For Delete
return (JOptionPane.showConfirmDialog(findWindow(c), prompt, title,
        JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION);
booleanpromptForDelete(Component c, String title, String prompt)
prompt For Delete
return (JOptionPane.showConfirmDialog(c, prompt, title,
        JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION);
voidshowDbxAccessDeniedPrompt()
show Dbx Access Denied Prompt
JOptionPane.showMessageDialog(null,
        "The application failed to connect to your Dropbox account.\nThis might mean that "
                + "your access token is no longer valid or you are not connected to the Internet.",
        "Could not connect to Dropbox", JOptionPane.ERROR_MESSAGE);