can not find symbo error message when use JOptionPane in GUI Netbeans

i am new to netbeans IDE, this is the 1st time i m using Netbeans IDe 5.5,
the problem that i face is i got error message when i call JOptionPane in the actionPerformedI() handler.
below is some part od my code and error message:


given jMenuItem1 is an menu item

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
        javax.swing.JOptionPane.showMessageDialog(null, "File clicked");
        //JOptionPane.showMessageDialog(null, "File clicked");
    }        

the error message i got is javax => javax is not a known variable in this current context..

thanks
derredbehAsked:
Who is Participating?
 
sciuriwareConnect With a Mentor Commented:
You got to add an import at the top of your source:

import javax.swing.JOptionPane;


;JOOP!
0
 
sciuriwareCommented:
I don't know NetBeans as I use ECLIPSE.
Eclipse has a function where all missing imports are added, sorted and organised.
I bet NetBeans has such a function.

;JOOP!
0
 
CEHJCommented:
>>javax.swing.JOptionPane.showMessageDialog(null, "File clicked");

If that line gives you an error, you may have either a broken installation or perhaps a very early version of the JDK

Try

System.out.println(System.getProperty("java.vm.version"));

If < 1.2, you haven't got Swing
0
 
derredbehAuthor Commented:
scriutiware and CEHJ, thank both of you very much....my problem has solved...thx!!
0
 
sciuriwareCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.