Can't Find Symbol

Im new in java and this error makes me sick!

OptPane.showMessageDialog("...","...",OptPane.ERROR_MESSAGE);

What is wrong here?

And here is the declaration for OptPane:

private javax.swing.JOptionPane OptPane;

[324 byte] By [Genomsarena] at [2007-11-27 6:53:04]
# 1
What error?Copy the error you are getting here.Also, variables should be camel case, first word lowercase, subsequent words uppercase. like: optPane
TuringPesta at 2007-7-12 18:27:46 > top of Java-index,Java Essentials,Java Programming...
# 2

showMessageDialog is a static method. Also, showMessageDialog needs to be passed a reference to the parent component, or null:

import javax.swing.*;

...

JOptionPane.showMessageDialog(null, "...", "...", JOptionPane.ERROR_MESSAGE);

Message was edited by:

Hippolyte

Hippolytea at 2007-7-12 18:27:46 > top of Java-index,Java Essentials,Java Programming...
# 3
thanks I didnt know that I had to put null there
Genomsarena at 2007-7-12 18:27:46 > top of Java-index,Java Essentials,Java Programming...
# 4

> thanks I didnt know that I had to put null there

Then you should set a bookmark to the API: http://java.sun.com/javase/6/docs/api/

For example: [url=http://java.sun.com/javase/6/docs/api/javax/swing/JOptionPane.html#showMessageDialog(java.awt.Component,%20java.lang.Object,%20java.lang.String,%20int)]showMessageDialog[/url]

Hippolytea at 2007-7-12 18:27:46 > top of Java-index,Java Essentials,Java Programming...