// This code goes in your Dialog class
// to shutdown the Dialog
// when the user clicks the Dismiss Button.
dismissButton.addActionListener
( new ActionListener()
     {
     /**
     * close down the Dialog when user clicks Dismiss
     */
     public void actionPerformed ( ActionEvent event )
        {
        Object object = event.getSource();
        if ( object == dismissButton )
           {
           dismiss();
           } // end if
        } // end actionPerformed
     } // end anonymous class
);   // end addActionListener line

// ---------------------------------------------

// How you would do the same thing with a named class

dismissButton.addActionListener( new CustomListener() );

...

private static class CustomListener implements ActionListener
   {
   /**
   * close down the Dialog when user clicks Dismiss
   */
   public void actionPerformed ( ActionEvent event )
      {
      Object object = event.getSource();
      if ( object == dismissButton )
         {
         dismiss();
         }
      }
   }