AWT introduced layouts to an unsuspecting, and soon befuddled, programming audience. Most programmers had learned to lay out controls by using drag-and-drop GUI builders or by editing resource files; with AWT, they had to write code. After a time, Java IDEs began to incorporate custom layout managers that allowed developers to drag and drop controls, but early adopters had to do without GUI builders. More puzzling, however, was the “layout” abstraction itself; many programmers (read: Windows programmers) were accustomed to specifying exact locations and sizes for each control. Aside from screen resolution technicalities, developers knew all they needed to know about the target machines when building applications, so absolute positioning made absolute sense. However, the cross-platform nature of Java demanded the abstraction; Java applications could be running on a variety of operating systems, on a variety of hardware. Developers no longer knew enough about all the target machines: what fonts were available, how large a text box would be to fit text vertically, how many pixels the decoration of a button would occupy, and so forth. Layouts handled the relative positioning and sizing of controls; as programmers learned how to harness their power, enthusiasm for layouts quickly grew.
KeywordsLeft Edge Layout Data Private Control Java Package Public Class
Unable to display preview. Download preview PDF.