Results 1 to 10 of 10
  1. #1
    awthz is offline Member
    Join Date
    Feb 2017
    Posts
    3
    Rep Power
    0

    Default Dialog box wont show.

    I am new to java and net beans and i was trying to try this code but the dialog box wont show up.

    Please help me..


    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    try{
    String uname = jTextField1.getText();
    char[] pwd = jPasswordField1.getPassword();
    String password=new String(pwd);
    if ((uname.equals("hai")&&(password.equals("hello"))) ){
    jOptionpane.showMessageDialog(null,"Valid User");
    }
    else{
    jOptionpane.showMessageDialog(null,"Invalid User");
    }
    }catch (Exception e){
    System.out.println(e.getMessage());
    }
    }

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

    Default Re: Dialog box wont show.

    Do you get any compiler errors? I am pretty sure NetBeans would complain about "symbol not found" or something like that on the lines where you write: jOptionpane. The correct class is JOptionPane. Java is case-sensitive.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    awthz is offline Member
    Join Date
    Feb 2017
    Posts
    3
    Rep Power
    0

    Default Re: Dialog box wont show.

    No bugs or errors at all and dont have any notifications or so, but the net beans output says that it is "Not Supported Yet"

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Dialog box wont show.

    Clearly you have an error. It is JOptionPane, not jOptionpane.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  5. #5
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

    Default Re: Dialog box wont show.

    Quote Originally Posted by jim829 View Post
    Clearly you have an error. It is JOptionPane, not jOptionpane.

    Regards,
    Jim
    Already suggested that. OP ain't buying it.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  6. #6
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Dialog box wont show.

    I know. I was reiterating your comment.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  7. #7
    gozzy is offline Member
    Join Date
    Jan 2017
    Posts
    46
    Rep Power
    0

    Default Re: Dialog box wont show.

    It's not impossible that 'jOptionPane' is an instance variable on which a static method can (but shouldn't) be called

  8. #8
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Dialog box wont show.

    It's possible. But all we have to go on is what is shown. It may just be the 'p' in pane. Even you capitalized it. The OP didn't.

    Regards,
    Jim
    Last edited by jim829; 02-10-2017 at 11:42 PM.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  9. #9
    awthz is offline Member
    Join Date
    Feb 2017
    Posts
    3
    Rep Power
    0

    Default Re: Dialog box wont show.

    Thank you Jim and SurfMan.. I did change the JOptionPane and still have no display on dialog box.

    I was not able to respond asap because i cant login on my laptop, i dont know why thou.

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Dialog box wont show.

    Is the jButton1ActionPerformed() method being called? Add a print statement at the very front of that method and see if it prints anything when you expect the method is being called. If the method is not called, the JOptionPane class's methods won't be executed.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. JOptionPane wont show up.
    By Dcalladi in forum New To Java
    Replies: 3
    Last Post: 02-09-2012, 07:30 PM
  2. Applet Wont Show Supposed Output, Please Help
    By bdmchamp in forum Java Applets
    Replies: 2
    Last Post: 06-29-2011, 02:54 PM
  3. Applet Wont Show Supposed Output, Please Help!!!!
    By bdmchamp in forum New To Java
    Replies: 7
    Last Post: 06-27-2011, 12:43 AM
  4. Graphics wont show up(paintComponent)
    By TheBreadCat in forum New To Java
    Replies: 3
    Last Post: 02-13-2011, 07:00 PM
  5. wont show entire JLabel
    By Billaguana in forum AWT / Swing
    Replies: 6
    Last Post: 02-03-2011, 11:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •