CookSwing Reference: LayoutManager Tags


 

 

Support This Project

 

stats counter

 

Logo SourceForge.net Logo IntelliJ IDEA

Layouts

Constraints


borderlayout

Class: BorderLayout

Child Description
constraint Used to set the location of the component within the constraint

Example:

<panel>
	<borderlayout>
		<constraint location="North">
			<button text="North">
		</constraint>
		<constraint location="Center">
			<button text="Center">
		</constraint>
	</borderlayout>
</panel>

boxlayout

Class: BoxLayout

Attribute Possible values Description
ctor LINE_AXIS
PAGE_AXIS
X_AXIS
y_AXIS
See Sun's JavaDoc

Example:

<panel>
	<boxlayout ctor="X_AXIS">
		<button text="1">
		<button text="2">
	</boxlayout>
</panel>

cardlayout

Class: CardLayout

Child Description
constraint Used to set the name of the component within the constraint

Example:

<panel>
	<cardlayout>
		<constraint name="button1">
			<button text="1">
		</constraint>
		<constraint name="button2">
			<button text="2">
		</constraint>
	</cardlayout>
</panel>

flowlayout

Class: FlowLayout

Example:

<panel>
	<flowlayout>
		<button text="1">
		<button text="2">
	</flowlayout>
</panel>

gridbaglayout

Class: GridBagLayout

Child Description
gridbagconstraints Used to set the constraint of the component inside the gridbagconstraints.

Example:

<panel>
	<gridbaglayout>
		<gridbagconstraints fill="BOTH" weightx="1.0" weighty="1.0">
			<button text="1" />
		</gridbagconstraints>
		<gridbagconstraints fill="BOTH" gridwidth="REMAINDER" weighty="1.0">
			<button text="2" />
		</gridbagconstraints>
	</gridbaglayout>
</panel>

gridlayout

Class: GridLayout

Example:

<panel>
	<gridlayout rows="2" columns="2">
		<button text="1" />
		<button text="2" />
		<button text="3" />
		<button text="4" />
	</gridlayout>
</panel>

springgridlayout

Creator: SpringGridCreator

Helper: SpringGridHelper

This layout is inspired by The Java Tutorial. It is similar to gridlayout, but with some tweaks. Currently, I am strictly using the utility provided in The Java Tutorial, which has a problem in that components in the last row/column can be misaligned with the rest in certain cases. The algorithm used by the utility is not wrong, but it did not make the consideration on the number rounding problem. I will try to find a fix when I have a time. Despite that, the grid generated looks absolutely fantastic.

Child Description
Component The component to be added to the parent container.

Example:

<panel>
	<springgridlayout rows="2" columns="2" hgap="5" vgap="5" initialx="5" initialy="5">
		<button text="1" />
		<button text="2" />
		<button text="3" />
		<button text="4" />
	</springgridlayout>
</panel>

springlayout

Class: SpringLayout

SpringLayout is a rather complicated and usually it is best left to a visual GUI generator to do the job.

Child Description
Component The component to be added to the parent container. A component must be added to the container first before its constraint can be set.
springconstraint Used to generate a grid layout using springs.

Example:

<panel>
	<springlayout>
		<label id="box_1" text="this is" />
		<textfield id="box_2" text="for gui builders only" font="Serif,bold italic,20" />
		<textfield id="box_3" text="extra extra long long long .......... field" />

		<springconstraint xpad="5" ypad="5">
			<idref ctor="box_1" />
		</springconstraint>

		<springconstraint xpad="5" preferredheight="true">
			<idref ctor="box_2" />
			<idref ctor="box_1" />
		</springconstraint>
		<springconstraint ypad="5">
			<idref ctor="box_2" />
		</springconstraint>

		<springconstraint>
			<spring setas="height" get="height">
				<idref ctor="box_2" />
			</spring>
			<idref ctor="box_1" />
		</springconstraint>

		<springconstraint xpad="5">
			<idref ctor="box_3" />
		</springconstraint>
		<springconstraint ypad="5">
			<idref ctor="box_3" />
			<idref ctor="box_1" />
		</springconstraint>

		<springconstraint clearwidth="true">
			<idref ctor="box_2" />
		</springconstraint>
		<springconstraint clearwidth="true" clearheight="true">
			<idref ctor="box_3" />
		</springconstraint>

		<springconstraint edge1="East" edge2="East" pad="-5">
			<idref ctor="box_2" />
			<idref ctor="boxparent" />
		</springconstraint>
		<springconstraint edge1="East" edge2="East" pad="-5">
			<idref ctor="box_3" />
			<idref ctor="boxparent" />
		</springconstraint>
		<springconstraint edge1="South" edge2="South" pad="-5">
			<idref ctor="box_3" />
			<idref ctor="boxparent" />
		</springconstraint>
	</springlayout>
</panel>

overlaylayout

Class: OverlayLayout

Child Description
constraint Used to set the name of the component within the constraint

Example:

<panel>
	<overlaylayout>
		<constraint name="button1">
			<button text="1">
		</constraint>
		<constraint name="button2">
			<button text="2">
		</constraint>
	</overlaylayout>
</panel>

constraint

Helper: ConstraintHelper

This class is used by borderlayout, cardlayout, and overlaylayout.

Child Description
Component The component to be added to the parent container.

gridbagconstraints

Class: GridBagConstraints

This class is used by gridbaglayout.

Child Description
Component The component to be added to the parent container.

spring

Class: Spring

This class is used by gridbaglayout.

Child Description
spring For spring calculation.
Component The component whose spring is going to be retrieved from.

springconstraint

Helper: SpringConstraintHelper

This class is used by springlayout.

Child Description
Component The first component is the constraint is to be set. The second component is the reference component. The second component is needed if the edge2 constraint is specified.

(c) Copyright 2004-2007 Heng Yuan. All rights reserved.

Valid XHTML 1.0! Valid CSS!