CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    12

    Implementing a Dialog



    How to implement a Dialog when a user clicks on a menu item in order to confirm his action ? My class extends the Frame class and I have to an instance of the Frame class to the Dialog class. When I click on the menu item, an exception occurs:"null parent frame".


    Thanks in advance.

    Mehdi

  2. #2
    Join Date
    Mar 1999
    Posts
    9

    Re: Implementing a Dialog



    Hi mehdi,


    Here is the code for ur question:

    // OpenDialog is the name of the menuitem

    // this is a inner class within ur class derived from frame

    class SymAction implements java.awt.event.ActionListener

    {

    public void actionPerformed(java.awt.event.ActionEvent event)

    {

    Object object = event.getSource();

    if (object == OpenDilaog)

    OpenDilaog_Action(event);

    }

    }


    void OpenDilaog_Action(java.awt.event.ActionEvent event)

    {

    // to do: code goes here.

    // this refers to the frame

    // the class u derived from Frame

    Dialog d = new Dialog(this,"Ur Dialog",true);

    // try using setSize if needed.

    d.resize(100,100);

    d.show();

    }


    // for any further details contact me at [email protected]

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured