FlowLayout to UIFlowLayout

To convert from AWT to AFC, instances of java.awt.FlowLayout should be transformed into instances of com.ms.ui.UIFlowLayout.

FlowLayout implements LayoutManager: be sure to see its changes.

Purpose and Usage

UIFlowLayout is a replacement for FlowLayout in AFC's improved UILayoutManager. The changes here are minimal. AWT's FlowLayout decides on its own whether the layout can wrap onto multiple lines. UIFlowLayout allows you to determine that by setting setwrap(boolean). You can also add and remove layout components from multiple containers in one method.

You may also want to try other layout managers that are provided with AFC and are similar to FlowLayout. UIVerticalFlowLayout arranges components in a vertical line; UIRowLayout arranges components in a single row; and UIFixedFlowLayout gives you more control over the width of the components, including allowing you to set a fixed width.

 

Porting

This is the set of changes you need to make to port all FlowLayout methods to UIFlowLayout methods. Any method not listed here or below does not need to be changed.

 

AWT Code AFC Code
FlowLayout() or
FlowLayout(int) or
FlowLayout(int, int, int)
UIFlowLayout() or
UIFlowLayout(int) or
UIFlowLayout(int, int, int)

 

Unsupported Methods

Some methods in java.awt.FlowLayout are not directly supported in com.ms.ui.UIFlowLayout. Those methods and suggested changes are described here.

 

AWT Code/Suggested AFC Code Comments
addLayoutComponent(String, Component)

addLayoutComponent(Container, Component, String)

You need to specify a container for the component.
removeLayoutComponent(Component)

removeLayoutComponent(Container, Component)

You need to specify the container holding the component.