I get this error when i make run my "JOptionPane.showOptionDialog" command. I have followed the steps on the Oracle toturial page, but this one just won't go. I can add my imports if it's needed, but the list is pretty long.
Object[] options = {"Ja", "Nej"}; //the values i want my buttons to have
int test = JOptionPane.showOptionDialog(null, //should make the panel, BlueJ marks showOptionDialog as the problem
spm, //this is a variable i define earlier in the code. Won't be a problem
"TestTwo", //the name of the window
JOptionPane.YES_NO_OPTION, //To be honest, idk what this do
null, //To be honest, idk what this do
options, //implements the values from the top
options[0]); //Don't really know this one either
You are missing argument MessageType
.
These are the arguments an option pane requires:
JOptionPane.showOptionDialog(parentComponent, message, title, optionType, messageType, icon, options, initialValue)
Object[] options = {"Ja", "Nej"};
int test = JOptionPane.showOptionDialog(null,
spm,
"TestTwo", //the name of the window
JOptionPane.YES_NO_OPTION, //Type of options, those two buttons at bottom of box
JOptionPane.PLAIN_MESSAGE, //The JOptionPane type
null, //Icon to be applied to dialog
options, //implements the values from the top
options[0]); //The default selected component when dialog opens
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments