• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 766
  • Last Modified:

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
0
derredbeh
Asked:
derredbeh
  • 3
1 Solution
 
sciuriwareCommented:
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now