JOptionPane won't pop up

Discussion in 'Java' started by rabbithole, Jun 26, 2008.

  1. rabbithole

    rabbithole

    Joined:
    Jun 23, 2008
    Messages:
    3
    Hi guys,

    I'm trying to write a program and I want to show a JOptionPane messagebox when an error occurs.

    I have this code:
    Code:
            try {
                MyMethod();                                              
            } catch (FileNotFoundException ex) {
                 JOptionPane.showMessageDialog(this,"File not Found");
                System.out.println("File not Found");
            } 
    allthough the filenotfound message is shown, the option pane is not.
    the code is in a class that starts with:
    Code:
    public class Gui extends javax.swing.JFrame 
    apparently the 'this' should be something else?
    can anyone give me an idea on what?
    rabbithole, Jun 26, 2008
    #1
    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. SuperChuck
    Replies:
    3
    Views:
    4,068
    Sandip Chitale
    Aug 7, 2003
  2. Joseph M. DeAngelo
    Replies:
    0
    Views:
    1,076
    Joseph M. DeAngelo
    Nov 9, 2003
  3. Alex Hunsley

    thread safeness of JOptionPane et al

    Alex Hunsley, Jan 13, 2004, in forum: Java
    Replies:
    0
    Views:
    761
    Alex Hunsley
    Jan 13, 2004
  4. jazzy

    Using JOptionPane

    jazzy, Apr 18, 2004, in forum: Java
    Replies:
    0
    Views:
    362
    jazzy
    Apr 18, 2004
  5. jazzy

    Using JOptionPane

    jazzy, Apr 18, 2004, in forum: Java
    Replies:
    0
    Views:
    566
    jazzy
    Apr 18, 2004
Loading...

Share This Page