Joptionpane showInputDialog with Title

showInputDialog()

Show a message and get one line of user input. The input dialog has an additional component for user input. This can be a text field into which the user can type an arbitrary string.

Program

 

 

 

Program Source

import javax.swing.JOptionPane;

public class Javaapp {
   
    public static void main(String[] args) {
       
        String name = JOptionPane.showInputDialog(null,
                                                  "Enter your name",
                                                  "Name Confirmation",
                                                  JOptionPane.INFORMATION_MESSAGE);
        JOptionPane.showMessageDialog(null,"Ok Done");
    }    
}

Leave a Comment