001/* ----------------------------------------------------------------------------
002   The Kiwi Toolkit - A Java Class Library
003   Copyright (C) 1998-2004 Mark A. Lindner
004
005   This library is free software; you can redistribute it and/or
006   modify it under the terms of the GNU General Public License as
007   published by the Free Software Foundation; either version 2 of the
008   License, or (at your option) any later version.
009
010   This library is distributed in the hope that it will be useful,
011   but WITHOUT ANY WARRANTY; without even the implied warranty of
012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013   General Public License for more details.
014
015   You should have received a copy of the GNU General Public License
016   along with this library; if not, write to the Free Software
017   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018   02111-1307, USA.
019 
020   The author may be contacted at: mark_a_lindner@yahoo.com
021   ----------------------------------------------------------------------------
022   $Log: WizardDialog.java,v $
023   Revision 1.5  2004/06/29 07:57:50  markl
024   Fixed to fire DialogDismissEvents.
025
026   Revision 1.4  2003/01/19 09:41:00  markl
027   Javadoc & comment header updates.
028
029   Revision 1.3  2001/03/12 05:20:00  markl
030   Source code cleanup.
031
032   Revision 1.2  1999/01/10 03:22:17  markl
033   added GPL header & RCS tag
034   ----------------------------------------------------------------------------
035*/
036
037package kiwi.ui.dialog;
038
039import java.awt.*;
040import java.awt.event.*;
041import javax.swing.*;
042
043import kiwi.event.*;
044import kiwi.ui.*;
045import kiwi.util.*;
046
047/** This class displays a <code>WizardView</code> in a dialog window.
048  * <p><center>
049  * <img src="snapshot/WizardDialog.gif"><br>
050  * <i>An example WizardDialog.</i>
051  * </center>
052  *
053  * @see kiwi.ui.WizardView
054  *
055  * @author Mark Lindner
056  */
057
058public class WizardDialog extends KDialog
059  {
060  /** Construct a new <code>WizardDialog</code>. The dialog is created with a
061    * default size of 400x400, but this can be overridden with a call to
062    * <code>setSize()</code>. The dialog is resizable by default, but this
063    * behavior can be changed with a call to <code>setResizable()</code>.
064    *
065    * @param parent The parent window.
066    * @param title The title for the dialog window.
067    * @param modal A flag specifying whether this dialog will be modal.
068    * @param view The <code>WizardView</code> to display in this dialog.
069    */
070
071  public WizardDialog(Frame parent, String title, boolean modal,
072                      WizardView view)
073    {
074    super(parent, title, modal);
075    
076    KPanel main = getMainContainer();
077    main.setBorder(KiwiUtils.defaultBorder);
078    main.setLayout(new GridLayout(1, 0));
079    main.add(view);
080    view.addActionListener(new ActionListener()
081        {
082        public void actionPerformed(ActionEvent evt)
083          {
084          if(evt.getActionCommand().equals("finish"))
085            doAccept();
086          else
087            doCancel();
088          }
089        });
090
091    setSize(400, 400);
092    }
093
094  }
095
096/* end of source file */