ExtremeSwat
ExtremeSwat

Reputation: 824

JOptionPane problems ( Java)

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.

Upvotes: 0

Views: 928

Answers (3)

duffymo
duffymo

Reputation: 308998

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.

Upvotes: 1

Sourabh Bhat
Sourabh Bhat

Reputation: 1893

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

Upvotes: 1

PakkuDon
PakkuDon

Reputation: 1615

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

Upvotes: 1

Related Questions