Java Utililty Methods JOptionPane Message

List of utility methods to do JOptionPane Message

Description

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

Method

StringgetStringInput(String message)
get String Input
String input;
while (true) {
    input = (String) JOptionPane.showInputDialog(null, message, "");
    if (input != null && input.trim().length() != 0)
        break;
return input;
StringgetStrInPane(String message, String title)
This method will display an input dialog box to receive a string of input from user
return JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE);
StringgetUserInputString(String message)
Inputs Dialog to retrieve a parameter
return JOptionPane.showInputDialog(message);
voidglobalMessagebox(String body, String title, int icon)
Makes sure that the message is visible no matter what (on any window)
JFrame fullscreen = new JFrame();
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
fullscreen.setSize(size);
fullscreen.setAlwaysOnTop(true);
JOptionPane.showMessageDialog(fullscreen, body, title, icon);
fullscreen.dispose();
fullscreen = null;
Stringinput(Component comp, String title, String message, Object def)
Displays an input dialog box and returns any text the user entered.
return input(comp, title, title, null, def);
Stringinput(String message, String title)
input
return JOptionPane.showInputDialog(null, message, title, JOptionPane.QUESTION_MESSAGE);
StringinputMessage(String str1)
input Message
return JOptionPane.showInputDialog(str1);
voidlog(String msg)
Writes a message to the log file.
System.out.println(msg);
if (logWriter != null && !loggingFailed) {
    try {
        logWriter.write(msg);
        logWriter.write('\n');
        logWriter.flush();
    } catch (IOException e) {
        e.printStackTrace();
...
voidmessage(Component comp, String title, String message)
Displays a dialog box.
JOptionPane.showMessageDialog(comp, message, title, JOptionPane.INFORMATION_MESSAGE);
voidmessage(String s)
message
JOptionPane.showMessageDialog(null, s, "Message", JOptionPane.INFORMATION_MESSAGE);