Java, JOptionPane cannot be applied to given types

Rune Nielsen

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.

Picture of the error i get

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
Jaskaranbir Singh

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

java constructor in class cannot be applied to given types

From Dev

Java Polymorphism "cannot be applied to given types"

From Dev

Constructor cannot be applied to given types?

From Dev

Construtor cannot be applied to given types

From Dev

Java error: constructor in class cannot be applied to given types

From Dev

java: constructor ranngeIpScanner in class cannot be applied to given types;

From Dev

Constructor in class cannot be applied to given types

From Dev

"Cannot be applied to given types" Error during PrintStream

From Dev

Issue with "Method in Class cannot be applied to given types"

From Dev

How to fix method cannot be applied to given types

From Dev

Constructor in class cannot be applied to given types

From Dev

Issue with "Method in Class cannot be applied to given types"

From Dev

Android Studio : cannot be applied into given types

From Dev

SQLite addData cannot be applied to given types

From Dev

Java - error: constructor "constructor name" in class "class name" cannot be applied to given types;

From Dev

Error Upon Compilation Java: "constructor LotteryTicket in class LotteryTicket cannot be applied to given types"

From Dev

Java beginners coding error - method contains in class String cannot be applied to given types

From Dev

Java 'constructor in class cannot be applied to given types' 'required: no arguments found: String'

From Dev

Constructor in class cannot be applied to given types. Hope for assistance

From Dev

Method cannot be applied to given types. Hope for assistance

From Dev

Error: Constructor Room in class Room cannot be applied to given types

From Dev

"constructor JSONParser in class JSONParser cannot be applied to given types" error occured

From Dev

Android: constructor ContactsAdapter in class ContactsAdapter cannot be applied to given types

From Dev

constructor in class cannot be applied to given types android studio

From Dev

Constructor in class cannot be applied to given types. Hope for assistance

From Dev

Method cannot be applied to given types. Hope for assistance

From Dev

Constructor cannot be applied to given types, and name should be declared

From Dev

error: method addOutcome in class OutcomesTable cannot be applied to given types

From Dev

Method edit in class data access cannot be applied to given types

Related Related

  1. 1

    java constructor in class cannot be applied to given types

  2. 2

    Java Polymorphism "cannot be applied to given types"

  3. 3

    Constructor cannot be applied to given types?

  4. 4

    Construtor cannot be applied to given types

  5. 5

    Java error: constructor in class cannot be applied to given types

  6. 6

    java: constructor ranngeIpScanner in class cannot be applied to given types;

  7. 7

    Constructor in class cannot be applied to given types

  8. 8

    "Cannot be applied to given types" Error during PrintStream

  9. 9

    Issue with "Method in Class cannot be applied to given types"

  10. 10

    How to fix method cannot be applied to given types

  11. 11

    Constructor in class cannot be applied to given types

  12. 12

    Issue with "Method in Class cannot be applied to given types"

  13. 13

    Android Studio : cannot be applied into given types

  14. 14

    SQLite addData cannot be applied to given types

  15. 15

    Java - error: constructor "constructor name" in class "class name" cannot be applied to given types;

  16. 16

    Error Upon Compilation Java: "constructor LotteryTicket in class LotteryTicket cannot be applied to given types"

  17. 17

    Java beginners coding error - method contains in class String cannot be applied to given types

  18. 18

    Java 'constructor in class cannot be applied to given types' 'required: no arguments found: String'

  19. 19

    Constructor in class cannot be applied to given types. Hope for assistance

  20. 20

    Method cannot be applied to given types. Hope for assistance

  21. 21

    Error: Constructor Room in class Room cannot be applied to given types

  22. 22

    "constructor JSONParser in class JSONParser cannot be applied to given types" error occured

  23. 23

    Android: constructor ContactsAdapter in class ContactsAdapter cannot be applied to given types

  24. 24

    constructor in class cannot be applied to given types android studio

  25. 25

    Constructor in class cannot be applied to given types. Hope for assistance

  26. 26

    Method cannot be applied to given types. Hope for assistance

  27. 27

    Constructor cannot be applied to given types, and name should be declared

  28. 28

    error: method addOutcome in class OutcomesTable cannot be applied to given types

  29. 29

    Method edit in class data access cannot be applied to given types

HotTag

Archive