Methods of JOptionPane
Methods |
Description |
---|---|
createDialog(String title) |
It helps us to create JDialog with a specified title but without any parent. |
showMessageDialog(Component parentComponent, Object message) |
This method displays a message dialog with the specified message. |
showInputDialog(Component parentComponent, Object message) |
This method displays an input dialog with the specified message. |
setMessageType(int messageType) |
This method to set the message type of the dialog |
setOptionType(int optionType) |
This method allows you to set the option type for the dialog. |
setOptions(Object[] options) |
Here we can set a list of custom options. |
setInitialValue(Object initialValue) |
This method sets the initial selection when using custom options in the dialog. |
Java JOptionPane
In Java, JOptionPane is a part of the Java Swing library. It helps us to create dialog boxes such as message dialogs, conformation dialogs, input dialogs, and options dialogs In this article, we are going to explore some constructors, methods, and some examples of JOptionPane.