To convert from AWT to AFC, instances of java.awt.LayoutManager2 should be transformed into instances of com.ms.ui.IUILayoutManager.
LayoutManager2 extends LayoutManager: be sure to see its changes.
AFC's IUILayoutManager serves as a replacement for both LayoutManager and LayoutManager2.
AFC's UILayoutManager works like AWT's LayoutManager2, creating an abstract layout manager with default keyboard handling. It also allows you to work with multiple containers. With interface IUILayoutManager, AFC provides several new and improved default layout managers, like UIBarLayout, UITabLayout, and UITreeLayout. (See the documentation for more details.)
If you wish to develop your own layout manager, the class UILayoutManager implements the interface IUILayoutManager, so you can derive from it for convenience. If you wish to use IUILayoutManager as your interface for your old class, however, you need to add the following methods to your extension of LayoutManager2:
adjustLayoutSize(IUIContainer, Dimension, IUIComponent, Dimension, Dimension)
continueInvalidate(IUIContainer, IUIComponent)
getComponent(IUIContainer, int)
getComponent(IUIContainer, Object)
navigate(IUIContainer, IUIComponent, int, boolean)
paintContainer(IUIContainer, FxGraphics)
This is the set of changes you need to make to port all LayoutManager2 methods to IUILayoutManager methods. Any method not listed here or below does not need to be changed.
AWT Code | AFC Code | Comments |
addLayoutComponent(Component, Object) | addLayoutComponent(IUIContainer, IUIComponent, Object) | You need to associate each layout with a container. |
maximumLayoutSize(Container) | preferredLayoutSize(IUIContainer) |
Some methods in java.awt.LayoutManager2 are not directly supported in com.ms.ui.IUILayoutManager. Those methods are listed here.
getLayoutAlignmentX(Container)
getLayoutAlignmentY(Container)
invalidateLayout(Container)