Dialog box in java | JOptionPane codes | Get input from user via GUI dialog box



package Lets_Programming;

import javax.swing.JOptionPane;

public class Dialog {

     public static void main(String[] args) {
    
          // paste any of the code here from following codes
          
     }
        
}


Types of Dialog box:



       // for getting input from the user (without message, with icon)
           JOptionPane.showInputDialog(null);






           //for getting the input from the user with message with icon
           JOptionPane.showInputDialog(null,"Here you can write any message for display");


     //for show message with error icon
           JOptionPane.showMessageDialog(null"Here we can write message""Error", JOptionPane.ERROR_MESSAGE);



           // for default or plan message for user
           JOptionPane.showMessageDialog(null"Here we can write message""Message", JOptionPane.DEFAULT_OPTION);






           //for show information with  icon
           JOptionPane.showMessageDialog(null"Here we can write message""Information", JOptionPane.INFORMATION_MESSAGE);




           //for show the warning message
           JOptionPane.showMessageDialog(null"Here we can write message""Customize your tile", JOptionPane.WARNING_MESSAGE);




           // for asking the Question form the user
     JOptionPane.showMessageDialog(null"Here we can write message""Do you know", JOptionPane.QUESTION_MESSAGE);
          

Comments

Popular posts from this blog

Operating System | Best Definition of Opetating System

Umbrella activities in Software Engineering