/*
 * $Source: c:\\cvshome/website/explicit_2_0/CenterDemo.java,v $
 * $Revision: 1.1 $
 * $Date: 2001/08/08 12:18:56 $
 *
 * Copyright (c) 2001 Zooki Technologies. All rights reserved.
 *
 */
package com.zookitec.layout.demo;

import java.awt.*;
import java.awt.event.*;
import com.zookitec.layout.*;


/**
 * Demonstrates how to center a component within its container
 */
public class CenterDemo extends Container {

    private DemoLabel label1 = new DemoLabel("1", 320, 240);
    private ExplicitLayout layout = new ExplicitLayout();

    public CenterDemo() {
        setLayout(layout);

        add(label1, new ExplicitConstraints(label1,
                ContainerEF.xFraction(0.5),
                ContainerEF.yFraction(0.5),
                MathEF.min(ComponentEF.preferredWidth(label1), ContainerEF.width()),
                MathEF.min(ComponentEF.preferredHeight(label1), ContainerEF.height()),
                0.5, 0.5, true, true));
    }


}


