Question

Code:

JOptionPane.showMessageDialog(null,"We're going to calculate the volume of a cylinder", JOptionPane.INFORMATION_MESSAGE);

Error:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: javax.swing.JOptionPane.showMessageDialog at ex.Ex.main(Ex.java:15)

I did some research and I am supposed to replace NULL with frame, a thing that I am supposed to declare from the java.awt.dialog library, although even after that it's not working. I just want to display that message box information_message.

Please help.

Was it helpful?

Solution

First advice? Take a breath. You can't code effectively if you're pissed off all the time. You are going to make lots of mistakes, so you don't want to be pissed off. Accept that fact and make the code better.

I would try passing the parent frame that created the dialog, not the dialog itself.

OTHER TIPS

There is no method for JOptionPane.showMessageDialog that takes exactly three arguments.

Try this line of code instead. I removed JOptionPane.INFORMATION_MESSAGE from the method call since that icon seems to be the default for message dialogs anyay.

JOptionPane.showMessageDialog(null,"We're going to calculate the volume of a cylinder");

I think you are missing an argument, use: JOptionPane.showMessageDialog(null, "We're going to calculate the volume of a cylinder", "Dialog Title", JOptionPane.INFORMATION_MESSAGE);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top