문제

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