Zooki Technologies Logo
Home Products Support

Java Component Development

ExplicitLayout 3.0
Overview
Features
System Requirements
Download
Screenshots
 - Center
 - Align
 - Simple Form
 - Resizing Form
 - Simple Grid
 - Complex Grid
 - Visibility
 - Vertical Flow
 - Fraction
 - Preferred Ratio
 - Geometry
 - Ratio Trigger
 - Properties
License Agreement

ExplicitLayout 'Component Visibility' Example

Screenshot
Demonstrates how to use ExplicitLayout to:
  • Control the layout behaviour when a component is invisible

This example demonstrates the use of the widthZeroIfInvisible and heightZeroIfInvisible flags of an ExplicitConstraints object. These flags control whether the width and height of a component is set to zero when the component is invisible.

The container has buttons labelled 'One' to 'Six' and some check boxes that allow you to change the visibility of some of the components. All buttons except 'Five' have both the widthZeroIfInvisible=true and heightZeroIfInvisible=true. Button five has its widthZeroIfInvisible=false. See source code for details of layout.

Notice the following behaviour (when running Demonstration Application):
  • 'Three' moves left when 'Two' is set invisible. This is because the width of 'Two' is set to zero when it is invisible.
  • 'Six' does not move when 'Five' is set invisible. This is because the width of 'Five' is unchanged when it is invisible.

For more sophisticated behaviour when components are made invisible, it is possible to modify the constraints at runtime (see Ratio Trigger example)

Source code: VisibilityDemo.java
Feedback Copyright © 2001 Zooki Technologies. All rights reserved.