package slides;

import java.applet.*;
import java.awt.*;
import javax.swing.*;

/**
 * A slide (for use in a  slide presentation)
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class  Slide extends    JPanel
{
    private SlideLayout          layout;



    /**
     * Default Constructor
     *
     * Note: This is used for a slide that does not
     * have a title
     */
    public Slide()
    {
	this(null);
    }


    /**
     * Explicit Value Constructor
     *
     * @param title   The title of the slide
     */
    public Slide(String title)
    {
	super();

	setBackground(SlidePresentation.BACKGROUND);
	setForeground(SlidePresentation.FOREGROUND);
	setName(title);
	layout = new SlideLayout();
	setLayout(layout);
    }



    /**
     * Add a "generic" bullet
     *
     * @param comp   The component to use
     * @param level  The indentation level
     */
    public void addBullet(Component comp, String level)
    {
	comp.setForeground(getForeground());
	comp.setBackground(getBackground());
	add(level, comp);
    }



    /**
     * Add a text bullet
     *
     * @param text   The text to use
     * @param level  The indentation level
     */
    public Component addBullet(String text, String level)
    {
	Label               b;

	b = new Label(text);
	b.setForeground(getForeground());
	b.setBackground(getBackground());
	add(level, b);

	return b;
    }





    /**
     * Set the visibility of this component
     *
     * @param ok   The visibility (true for visible)
     */
    public void setVisible(boolean ok)
    {
	Component[]   c;
	int i;


	c = getComponents();
	for (i=0; i < c.length; i++) c[i].setVisible(ok);
    }


}
