Title: Professional Java Programming
ISBN: 186100382x
US Price: $ 59.99
Canadian Price:
C$ 89.95
UK Price: £ 45.99
© Wrox Press Limited, US and UK.

Reviews : Java Books :
Professional Java Programming : Using Layout Managers

removeLayoutComponent()

This method is called when a component is removed from the container. Your custom layout manager should remove any references to the component, as well as any data it maintains that's related to the component, such as constraint information. The implementation of this method in DividerLayout is shown below:

 
public void removeLayoutComponent(Component comp) {
	if (comp == westComponent) {
		westComponent = null;
	}
	else if (comp == centerComponent) {
		centerComponent = null;
	}
	else if (comp == eastComponent) {
		centerComponent = null;
	}
}

preferredLayoutSize() and minimumLayoutSize()

preferredLayoutSize() is similar to the maximumLayoutSize() method described earlier, and in fact its implementation will often differ only in that it calls the getPreferredSize() method for each component instead of getMaximumSize(). The purpose of this method is to calculate the preferred size of the Container instance associated with this layout manager. The implementation of this method in DividerLayout is shown below:

 
public Dimension preferredLayoutSize(Container parent) {
	Dimension size;
	int width = 0;
	int height = 0;
	if ((westComponent != null) && (westComponent.isVisible())) {
		size = westComponent.getPreferredSize();
		width = Math.max(width, size.width);
		height = Math.max(height, size.height);
	}
	if ((eastComponent != null) && (eastComponent.isVisible())) {
		size = eastComponent.getPreferredSize();
		width = Math.max(width, size.width);
		height = Math.max(height, size.height);
	}
	width *= 2;
	if ((centerComponent != null) && (centerComponent.isVisible())) {
		size = centerComponent.getPreferredSize();
		width += size.width;
		height = Math.max(height, size.height);
	}
	return new Dimension(width, height);
}

Similarly, minimumLayoutSize() differs only in that it calls the getMinimumSize() method instead of getPreferredSize() or getMaximumSize(); the purpose of this method is to calculate the minimum size of the Container instance associated with this layout manager:

public Dimension minimumLayoutSize(Container parent) {
	Dimension size;
	int width = 0;
	int height = 0;
	if ((westComponent != null) && (westComponent.isVisible())) {
		size = westComponent.getMinimumSize();
		width = Math.max(width, size.width);
		height = Math.max(height, size.height);
	}
	if ((eastComponent != null) && (eastComponent.isVisible())) {
		size = eastComponent.getMinimumSize();
		width = Math.max(width, size.width);
		height = Math.max(height, size.height);
	}
	width *= 2;
	if ((centerComponent != null) && (centerComponent.isVisible())) {
		size = centerComponent.getPreferredSize();
		width += size.width;
		height += Math.max(height, size.height);
	}
	return new Dimension(width, height);
}

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.