package frame;

//~--- JDK imports ------------------------------------------------------------

import java.awt.*;

import javax.swing.*;

public class JScreenLine extends Component {
    private JSeparator   sep = new JSeparator(JSeparator.HORIZONTAL);
    private Component    leftComp;
    private JProgressBar progressBar;
    private JFrame       superFrame;

    public JScreenLine(boolean withProgressBar) {
        if (withProgressBar) {
            this.progressBar = new JProgressBar();
        } else {}
    }

    public JProgressBar getProgressBar() {
        return progressBar;
    }

    public void setProgressBarWidth(int width) {
        this.progressBar.setSize(width, 19);
    }

    public void setLeftComp(Component c) {
        leftComp = c;
    }

    public Component getLeftComp() {
        return leftComp;
    }

    public void removeProgressBar() {
        this.progressBar = null;
    }

    public void removeLeftComp() {
        this.leftComp = null;
    }

    public void paint(Graphics g) {
        sep.setBounds(0, this.getParent().getHeight() - 22, this.getParent().getWidth(), 10);
        this.getParent().add(sep);

        if (this.progressBar != null) {
            this.progressBar.setBounds(this.getParent().getWidth() - this.progressBar.getWidth(),
                                       this.getParent().getHeight() - this.progressBar.getHeight(), 150, 19);
            this.getParent().add(this.progressBar);
        }

        if (leftComp != null) {
            int w = leftComp.getWidth();

            leftComp.setBounds(0, this.getParent().getHeight() - 22, w, 22);
            this.getParent().add(leftComp);
        }
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
