#Why aren't my dialog boxes working on eclipse?

1 messages · Page 1 of 1 (latest)

flat halo
#

Hello,
Every time i try to use dialog boxes it gives a compiler error. at first it wouldn't let me even import the JOptionPane package, then when i got it to work it didn't let me show the dialog box.

naive flax
#

Can you show us what it says when you pass your cursor on function?

flat halo
#

im not sure if the import is working properly as well

viscid beacon
# flat halo

Do you understand the exact meaning of that error?

flat halo
#

I think so

#

its saying that its undefined for the statement

#

would it work if I made a string first?

#

and then added it

light relic
#

is it a member function ?

#

you are calling it statically

naive flax
#

The calling should be correct

light relic
#

JOptionPage showInputDialog

#

static String showInputDialog(Object message)
Shows a question-message dialog requesting input from the user.

static String showInputDialog(Object message, Object initialSelectionValue)

Shows a question-message dialog requesting input from the user, with the input value initialized to initialSelectionValue.

flat halo
#

Yea the import isn't working for some reason

light relic
#

you are using jdk17 not jdk8

#

they changed in jdk9+ how package works

flat halo
#

im using jdk17

light relic
#

that's what I said

#

anything above jdk8 is using jigsaw packaging

flat halo
#

ohhhh

#

i see let me try changing it

light relic
#

you need to define a module that requires the desktop module in jdk9+

#

so that jlink links your code with javax swing

#

and cast your String as Object

#

to match the static method signature

flat halo
#

i switched to 1.8 let me try the java desktop

#

I got it to work

#

I had to use this weird method