class ProgressDialog extends JDialog {

    /**
     * the icon used for this dialog box.
     */
    public static final JLabel INFO = new JLabel(UIManager.getIcon("OptionPane.informationIcon"));
    /**
     * a serial version uid.
     */
    private static final long serialVersionUID = -8286949678008659120L;
    /**
     * label showing the message describing what's in progress.
     */
    protected JLabel message;
    /**
     * the progress bar
     */
    protected JProgressBar progress;

    /**
     * Creates a Progress frame displaying a certain message and a progress bar in indeterminate mode.
     *
     * @param parent the parent frame of this dialog (used to position the dialog)
     * @param msg    the message that will be displayed.
     */
    public ProgressDialog(JFrame parent, String msg) {
        super();
        this.setTitle("Progress...");
        setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        setSize(300, 100);
        this.setLocationRelativeTo(parent);

        setLayout(new GridBagLayout());
        GridBagConstraints constraints = new GridBagConstraints();
        constraints.gridx = 0;
        constraints.gridy = 0;
        constraints.gridheight = 2;
        getContentPane().add(INFO, constraints);
        constraints.gridheight = 1;
        constraints.gridx = 1;
        constraints.insets = new Insets(5, 5, 5, 5);
        message = new JLabel(msg);
        getContentPane().add(message, constraints);
        constraints.gridy = 1;
        progress = new JProgressBar();
        progress.setIndeterminate(true);
        getContentPane().add(progress, constraints);

        setVisible(true);
    }

    /**
     * Changes the message describing what's in progress
     *
     * @param msg the message describing what's in progress
     */
    public void setMessage(String msg) {
        message.setText(msg);
    }

    /**
     * Changes the value of the progress bar.
     *
     * @param value the current value
     */
    public void setValue(int value) {
        progress.setValue(value);
    }

    /**
     * Sets the maximum value for the progress bar. If 0 or less, sets the progress bar to indeterminate mode.
     *
     * @param n the maximum value for the progress bar
     */
    public void setTotal(int n) {<FILL_FUNCTION_BODY>}
}

        if (n > 0) {
            progress.setMaximum(n);
            progress.setIndeterminate(false);
            progress.setStringPainted(true);
        } else {
            progress.setIndeterminate(true);
            progress.setStringPainted(false);
        }
    
<methods>public void <init>() ,public void <init>(java.awt.Frame) ,public void <init>(java.awt.Dialog) ,public void <init>(java.awt.Window) ,public void <init>(java.awt.Frame, boolean) ,public void <init>(java.awt.Frame, java.lang.String) ,public void <init>(java.awt.Dialog, boolean) ,public void <init>(java.awt.Dialog, java.lang.String) ,public void <init>(java.awt.Window, java.awt.Dialog.ModalityType) ,public void <init>(java.awt.Window, java.lang.String) ,public void <init>(java.awt.Frame, java.lang.String, boolean) ,public void <init>(java.awt.Dialog, java.lang.String, boolean) ,public void <init>(java.awt.Window, java.lang.String, java.awt.Dialog.ModalityType) ,public void <init>(java.awt.Frame, java.lang.String, boolean, java.awt.GraphicsConfiguration) ,public void <init>(java.awt.Dialog, java.lang.String, boolean, java.awt.GraphicsConfiguration) ,public void <init>(java.awt.Window, java.lang.String, java.awt.Dialog.ModalityType, java.awt.GraphicsConfiguration) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.awt.Container getContentPane() ,public int getDefaultCloseOperation() ,public java.awt.Component getGlassPane() ,public java.awt.Graphics getGraphics() ,public javax.swing.JMenuBar getJMenuBar() ,public javax.swing.JLayeredPane getLayeredPane() ,public javax.swing.JRootPane getRootPane() ,public javax.swing.TransferHandler getTransferHandler() ,public static boolean isDefaultLookAndFeelDecorated() ,public void remove(java.awt.Component) ,public void repaint(long, int, int, int, int) ,public void setContentPane(java.awt.Container) ,public void setDefaultCloseOperation(int) ,public static void setDefaultLookAndFeelDecorated(boolean) ,public void setGlassPane(java.awt.Component) ,public void setJMenuBar(javax.swing.JMenuBar) ,public void setLayeredPane(javax.swing.JLayeredPane) ,public void setLayout(java.awt.LayoutManager) ,public void setTransferHandler(javax.swing.TransferHandler) ,public void update(java.awt.Graphics) <variables>protected javax.accessibility.AccessibleContext accessibleContext,private int defaultCloseOperation,private static final java.lang.Object defaultLookAndFeelDecoratedKey,protected javax.swing.JRootPane rootPane,protected boolean rootPaneCheckingEnabled,private javax.swing.TransferHandler transferHandler