Search code examples
javajoptionpane

Error when customising JOptionPane Message Dialog Buttons


I'm receiving the error: no suitable method found for showMessageDialog when trying to customise a showMessageDialog button to say "Start" instead of OK.

This is the code:

JOptionPane.showMessageDialog(frame, radioPanel, "Start Game", JOptionPane.PLAIN_MESSAGE, null, new String[]{"Start"});

Could someone point out why I might be receiving this error.

Thanks in advance


Solution

  • There are 3 overloads of showMessageDialog:

    You are trying to call this method with 6 arguments, so none apply. You need to carefully read the documentation to decide which one you require.