/*
 * Progress.java  $Revision: 1.3 $  $Date: 2007/10/03 04:39:40 $
 *
 * Copyright (C) 2007 Meldcraft Corporation
 *
 * This file is part of Scaffold.
 * 
 * Scaffold is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Scaffold is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with Scaffold.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.meldcraft.gui.swing;

import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Window;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.WindowConstants;

/**
 * @version $Revision: 1.3 $ $Date: 2007/10/03 04:39:40 $
 * @author rob
 */
public class Progress
{
// Static variables
// Member variables
// Constructors and initialization
// Interface implemenations
// Public methods
    public static JDialog createBusyDialog(Component parent)
    {
        JDialog dialog = null;

        Window window = SwingUtil.getJFrameOrJDialog(parent);
        if (window instanceof JFrame)
        {
            dialog = new JDialog((JFrame)window, "Progress", false);
        }
        else
        {
            dialog = new JDialog((JDialog)window, "Progress", false);
        }

        JProgressBar bar = new JProgressBar();
        bar.setIndeterminate(true);

        dialog.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 13,13));
        dialog.getContentPane().add(bar);

        dialog.setResizable(false);
        //dialog.setUndecorated(true);
        dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

        dialog.pack();
        dialog.setLocationRelativeTo(parent);

        return dialog;
    }

// Protected methods
// Private methods
// Inner classes
}
