1 /*
2 * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
38 * constraint-based layout managers.
39 *
40 * @see LayoutManager
41 * @see Container
42 *
43 * @author Jonni Kanerva
44 */
45 public interface LayoutManager2 extends LayoutManager {
46
47 /**
48 * Adds the specified component to the layout, using the specified
49 * constraint object.
50 * @param comp the component to be added
51 * @param constraints where/how the component is added to the layout.
52 */
53 void addLayoutComponent(Component comp, Object constraints);
54
55 /**
56 * Calculates the maximum size dimensions for the specified container,
57 * given the components it contains.
58 * @see java.awt.Component#getMaximumSize
59 * @see LayoutManager
60 */
61 public Dimension maximumLayoutSize(Container target);
62
63 /**
64 * Returns the alignment along the x axis. This specifies how
65 * the component would like to be aligned relative to other
66 * components. The value should be a number between 0 and 1
67 * where 0 represents alignment along the origin, 1 is aligned
68 * the furthest away from the origin, 0.5 is centered, etc.
69 */
70 public float getLayoutAlignmentX(Container target);
71
72 /**
73 * Returns the alignment along the y axis. This specifies how
74 * the component would like to be aligned relative to other
75 * components. The value should be a number between 0 and 1
76 * where 0 represents alignment along the origin, 1 is aligned
77 * the furthest away from the origin, 0.5 is centered, etc.
78 */
79 public float getLayoutAlignmentY(Container target);
80
81 /**
82 * Invalidates the layout, indicating that if the layout manager
83 * has cached information it should be discarded.
84 */
85 public void invalidateLayout(Container target);
86
87 }
|
1 /*
2 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
38 * constraint-based layout managers.
39 *
40 * @see LayoutManager
41 * @see Container
42 *
43 * @author Jonni Kanerva
44 */
45 public interface LayoutManager2 extends LayoutManager {
46
47 /**
48 * Adds the specified component to the layout, using the specified
49 * constraint object.
50 * @param comp the component to be added
51 * @param constraints where/how the component is added to the layout.
52 */
53 void addLayoutComponent(Component comp, Object constraints);
54
55 /**
56 * Calculates the maximum size dimensions for the specified container,
57 * given the components it contains.
58 *
59 * @see java.awt.Component#getMaximumSize
60 * @see LayoutManager
61 * @param target the target container
62 * @return the maximum size of the container
63 */
64 public Dimension maximumLayoutSize(Container target);
65
66 /**
67 * Returns the alignment along the x axis. This specifies how
68 * the component would like to be aligned relative to other
69 * components. The value should be a number between 0 and 1
70 * where 0 represents alignment along the origin, 1 is aligned
71 * the furthest away from the origin, 0.5 is centered, etc.
72 *
73 * @param target the target container
74 * @return the x-axis alignment preference
75 */
76 public float getLayoutAlignmentX(Container target);
77
78 /**
79 * Returns the alignment along the y axis. This specifies how
80 * the component would like to be aligned relative to other
81 * components. The value should be a number between 0 and 1
82 * where 0 represents alignment along the origin, 1 is aligned
83 * the furthest away from the origin, 0.5 is centered, etc.
84 *
85 * @param target the target container
86 * @return the y-axis alignment preference
87 */
88 public float getLayoutAlignmentY(Container target);
89
90 /**
91 * Invalidates the layout, indicating that if the layout manager
92 * has cached information it should be discarded.
93 * @param target the target container
94 */
95 public void invalidateLayout(Container target);
96
97 }
|