KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > LayoutManager2


1 /*
2  * @(#)LayoutManager2.java 1.14 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package java.awt;
8
9 /**
10  * Defines an interface for classes that know how to layout Containers
11  * based on a layout constraints object.
12  *
13  * This interface extends the LayoutManager interface to deal with layouts
14  * explicitly in terms of constraint objects that specify how and where
15  * components should be added to the layout.
16  * <p>
17  * This minimal extension to LayoutManager is intended for tool
18  * providers who wish to the creation of constraint-based layouts.
19  * It does not yet provide full, general support for custom
20  * constraint-based layout managers.
21  *
22  * @see LayoutManager
23  * @see Container
24  *
25  * @version 1.14, 12/19/03
26  * @author Jonni Kanerva
27  */

28 public interface LayoutManager2 extends LayoutManager JavaDoc {
29
30     /**
31      * Adds the specified component to the layout, using the specified
32      * constraint object.
33      * @param comp the component to be added
34      * @param constraints where/how the component is added to the layout.
35      */

36     void addLayoutComponent(Component JavaDoc comp, Object JavaDoc constraints);
37
38     /**
39      * Calculates the maximum size dimensions for the specified container,
40      * given the components it contains.
41      * @see java.awt.Component#getMaximumSize
42      * @see LayoutManager
43      */

44     public Dimension JavaDoc maximumLayoutSize(Container JavaDoc target);
45
46     /**
47      * Returns the alignment along the x axis. This specifies how
48      * the component would like to be aligned relative to other
49      * components. The value should be a number between 0 and 1
50      * where 0 represents alignment along the origin, 1 is aligned
51      * the furthest away from the origin, 0.5 is centered, etc.
52      */

53     public float getLayoutAlignmentX(Container JavaDoc target);
54
55     /**
56      * Returns the alignment along the y axis. This specifies how
57      * the component would like to be aligned relative to other
58      * components. The value should be a number between 0 and 1
59      * where 0 represents alignment along the origin, 1 is aligned
60      * the furthest away from the origin, 0.5 is centered, etc.
61      */

62     public float getLayoutAlignmentY(Container JavaDoc target);
63
64     /**
65      * Invalidates the layout, indicating that if the layout manager
66      * has cached information it should be discarded.
67      */

68     public void invalidateLayout(Container JavaDoc target);
69
70 }
71
Popular Tags