ButtonLayout.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 1996-1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
/**
* <CODE>ButtonLayout</CODE> is used to layout buttons in a
* <CODE>Panel</CODE>. It will arrange buttons left to right
* until no more buttons fit on the same line. Each line is
* centered. All buttons are set to an equal size.<P>
*
* While <CODE>ButtonLayout</CODE> was designed for <CODE>Buttons</CODE>,
* any component can be added to the layout. All components are
* set to an equal size.<P>
*
*/
public class ButtonLayout implements LayoutManager {
int hgap;
int vgap;
/**
* Constructs a new <CODE>ButtonLayout</CODE> with a centered alignment.
*/
public ButtonLayout() {
}
/**
* Constructs a new <CODE>ButtonLayout</CODE> with the specified alignment.
* @param align</VAR> The alignment value.
* @see ALIGNMENT
*/
}
/**
* Constructs a new <CODE>ButtonLayout</CODE> with the specified
* alignment and gap values.
* @param align</VAR> The alignment value.
* @param hgap</VAR> The horizontal gap variable.
* @param vgap</VAR> The vertical gap variable.
* @see ALIGNMENT
*/
}
/**
* Adds the specified component to the layout. This is not
*used by this class.
* @param name</VAR> The name of the component.
* @param comp</VAR> The component to be added.
*/
}
/**
* Removes the specified component from the layout. This
* is not used by this class.
* @param comp</VAR> The component to remove.
*/
}
/**
* Returns the preferred dimensions for this layout given
* the components in the specified target container.
* @param target</VAR> The component that needs to be laid out.
* @see java.awt.Container
* @see #minimumLayoutSize
*/
for (int i = 0; i < nmembers; i++) {
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
}
}
return dim;
}
/**
* Returns the minimum dimensions needed to layout the components
* contained in the specified target container.
* @param target</VAR> The component that needs to be laid out
* @see #preferredLayoutSize
*/
for (int i = 0; i < nmembers; i++) {
if (m.isVisible()) {
Dimension d = m.getMinimumSize();
}
}
return dim;
}
/**
* Centers the elements in the specified row, if there is any slack.
* @param target</VAR> The component which needs to be moved.
* @param x</VAR> The x coordinate.
* @param y</VAR> The y coordinate.
* @param width</VAR> The width dimensions.
* @param height</VAR> The height dimensions.
* @param rowStart</VAR> Index of the first component in the row.
* @param rowEnd</VAR> Index of the last component in the row.
*/
// do nothing
x += width / 2;
x += width;
}
if (m.isVisible()) {
}
}
}
/**
* Lays out the container. This method will actually reshape the
* components in the target in order to satisfy the constraints of
* the <CODE>BorderLayout</CODE> object.
* @param target</VAR> The specified component being laid out.
* @see java.awt.Container
*/
for (int i = 0; i < nmembers; i++) {
if (m.isVisible()) {
Dimension d = m.getMinimumSize();
}
}
for (int i = 0; i < nmembers; i++) {
if (m.isVisible()) {
Dimension d = m.getPreferredSize();
if (x > 0) {
x += hgap;
}
} else {
start = i;
}
}
}
}
/**
* Returns the <CODE>String</CODE> representation of this
* <CODE>ButtonLayout</CODE>'s values.
*/
str = ",align=left";
str = ",align=right";
str = ",align=center";
}
}
}