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.

有帮助吗?

解决方案

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.

其他提示

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);

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top