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)
//for getting the input from the user with message with icon
//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
Post a Comment