import java.awt.*;
import java.util.*;
//import javax.swing.*;

public class STUFF extends Frame
{
    ArrayList<Label> cards = new ArrayList<Label>();

    public STUFF()
    {
        setLayout( null );

        cards.add( createCard("1", Color.RED) );
        cards.add( createCard("2", Color.GREEN) );
        cards.add( createCard("3", Color.BLUE) );
        cards.add( createCard("4", Color.YELLOW) );

        //  This would be your first natural attempt (but it doesn't work)

        //for (int i = 0; i < cards.size(); i++)
        //    add( cards.get(i) );

        //  This affects the Z-Order to do what you want

	for (int i = 0; i < cards.size(); i++)
	    add(cards.get(i), 0);   //0


	
    }

    public Label createCard(String text, Color background)
    {
        Label label = new Label(text);
        //label.setOpaque( true );
        label.setBackground( background );
        label.setSize(30, 70);
        label.setLocation((cards.size() + 1) * 20 , 20);

        return label;
    }



    public static void main(String[] args)
    {
        STUFF frame = new STUFF();
        //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //frame.add(new SSCCE());
        //frame.setLocationByPlatform( true );
        frame.setSize(200, 200);
        frame.setVisible( true );
	frame.setLayout(null);
    }

}
