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 23 * questions. 24 */ 25 package java.awt; 26 27 /** 28 * Defines an interface for classes that know how to layout Containers 29 * based on a layout constraints object. 30 * 31 * This interface extends the LayoutManager interface to deal with layouts 32 * explicitly in terms of constraint objects that specify how and where 33 * components should be added to the layout. 34 * <p> 35 * This minimal extension to LayoutManager is intended for tool 36 * providers who wish to the creation of constraint-based layouts. 37 * It does not yet provide full, general support for custom 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 }