Checkpoint 1.4 - Java
Dynamic GUI layout is used
WCAG 1.0 Priority 2
WCAG Guideline 3. Use markup and style sheets and do so properly.
A dynamic LayoutManager positions graphical objects relative to each other, so that changes in size are handled automatically and objects never obscure one another. This repositioning is necessary so that font changes can be reflected in the user interface without hiding components and making them unusable.
Developers using the Java platform must never call the setSize() method with constant values. Using constant parameters defeats dynamic layout and the resulting application will not adapt properly to users' settings.
Requirement
The GUI layout must be dynamic
Recommendation
The full benefits of dynamic layout can be realized easily by adjusting the size of each JFrame, JDialog, and JWindow at creation and each time its contents change. This allows all nested layout managers to affect the size and position of each object at runtime.
// Invoke on eachJFrame,JDialog, andJWindowat creation // and whenever its contents change window.setSize(window.getPreferredSize());
Defeating the LayoutManager makes it necessary for the developer to manually set the (x,y) position of every Component. Not only is this far more work but also yields an interface that will not properly adapt to many accessibility options, nor will it work properly with internationalization or user-defined preferences.
Checking Tool
Review the source code of the applet/application to ensure that there are no instances of setLayout(null) and that the setSize() method is not called with constant values.
Information Source
The original source of this information is located on the W3C web site (www.w3.org/TR/WCAG10-TECHS/#tech-relative-units)