188k views
0 votes
How is the JOptionPaneclass used to display a dialog box that performs a yes/noconfirmation?

User Miqe
by
5.6k points

1 Answer

4 votes

Answer:

JOptionPane.showConfirmDialog() function with the option_type parameter set to JOptionPane.YES_NO_OPTION

Step-by-step explanation:

JOptionPane is a java swing class which enables users to display different kinds of standard dialog boxes such as - InputDialog, MessageDialog, ConfirmDialog or OptionDialog.

In order to display a Yes/No confirmation we can use JOptionPane.showConfirmDialog() function. This function takes a parameter called option_type. In order to display Yes/No options for the confirmation dialog, the option_type parameter needs to be set to the value JOptionPane.YES_NO_OPTION.

User Ben Thompson
by
5.7k points