All About Containers
We come now to the third of the three ideas common to all Java GUI programs: grouping together controls and arranging them neatly by adding them to a container.
We've seen this when we added the JComponents to the content pane of a JFrame, and the JFrame showed up on the screen. The piece that is new is that a container can have different layout policies for where components go on the screen when you add them. A layout policy might be, “Add components from left to right across the container. When you reach the right-hand margin, start a new line of them.” Another layout policy might be, “Components can go to the north, south, east, west, or in the center of the component. You have to tell me where you add one.” There ...
Get Just Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.