Cannot resolve symbol

Discussion in 'Java' started by Jo, Apr 9, 2004.

  1. Jo

    Jo Guest

    Does anyone know why I'm getting a "cannot resolve symbol method
    showMessageDialog(java.lang.String)" error from this line here:

    javax.swing.JOptionPane.showMessageDialog("Hello world.");

    BTW It's just sitting in a normal class, not a frame.
    Jo, Apr 9, 2004
    #1
    1. Advertising

  2. Jo wrote:

    > Does anyone know why I'm getting a "cannot resolve symbol method
    > showMessageDialog(java.lang.String)" error from this line here:
    >
    > javax.swing.JOptionPane.showMessageDialog("Hello world.");
    >
    > BTW It's just sitting in a normal class, not a frame.


    The compiler tells you this because there is no such method.

    When you look at the API docs at
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JOptionPane.html,
    you'll see the methods that do exist.

    --
    Kind regards,
    Christophe Vanfleteren
    Christophe Vanfleteren, Apr 9, 2004
    #2
    1. Advertising

  3. Jo wrote:
    > Does anyone know why I'm getting a "cannot resolve symbol method
    > showMessageDialog(java.lang.String)" error from this line here:
    >
    > javax.swing.JOptionPane.showMessageDialog("Hello world.");
    >
    > BTW It's just sitting in a normal class, not a frame.
    >
    >


    Did you read the API documentation for the JOptionPane class ?

    You're getting the error because the JOptionPane class does not have a
    showMessageDialog method with a single String argument. All the variants
    of the showMessageDialog take 2 or more arguments.

    BK
    Babu Kalakrishnan, Apr 9, 2004
    #3
  4. Jo

    Roedy Green Guest

    On Fri, 9 Apr 2004 12:59:54 +0100, "Jo" <> wrote or
    quoted :

    >javax.swing.JOptionPane.showMessageDialog("Hello world.");


    check the JavaDoc. There is no such method. I think you wanted this
    one:

    showMessageDialog(Component parentComponent, Object message, String
    title, int messageType)


    Brings up a dialog that displays a message using a default
    icon determined by the messageType parameter.
    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Apr 10, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. @lex-kid
    Replies:
    2
    Views:
    2,392
    @lex-kid
    Jul 7, 2003
  2. sufia
    Replies:
    1
    Views:
    3,036
    @lex-kid
    Jul 6, 2003
  3. vivienne wykes
    Replies:
    4
    Views:
    919
    Roedy Green
    Jul 28, 2004
  4. Jody
    Replies:
    1
    Views:
    676
    Andrew Thompson
    Nov 11, 2004
  5. Replies:
    1
    Views:
    10,153
Loading...

Share This Page