Figure 9-10: Three buttons laid out with an OrientableFlowLayout in horizontal orientation.


Figure 9-11: Three buttons laid out with an OrientableFlowLayout in vertical orientation.
In a FlowLayout, if there's not enough space to place all the components on one line, some will be shifted down to the next line. The same thing happens in an OrientableFlowLayout. However, if the layout is oriented vertically, then the excess components are shifted left to the next column instead. Figure 9-12 demonstrates.

Figure 9-12: The left-shifting of an OrientableFlowLayout


If a FlowLayout has more space than the components need, then they can be left aligned, right aligned, or centered. The default is to center them. OrientableFlowLayouts also have alignments, but they have two: horizontal and vertical. Possible horizontal allignments are FlowLayout.LEFT, FlowLayout.CENTER, and FlowLayout.RIGHT, just like for a FlowLayout. however, they're also three vertical alignments: OrientableFlowLayout.TOP, OrientableFlowLayout.CENTER, and OrientableFlowLayout.BOTTOM. Figures 9-13 through 9-15 show these three possibilities. Notice that alignment not-withstanding, the first component is always placed at the top, the second, one down from that and so on. The alignment is with the bottom, but thu flow is still top-to-bottom.

OrientableFlowLayout.CENTER is inherited from FlowLayout.CENTER. It has the same value whetehr we're talking about horizontal or vertical centering.

Figure 9-13: Three buttons arranged in a top aligned vertical OrientableFlowLayout.


Figure 9-14: Three buttons arranged in a center aligned OrientableFlowLayout..


Figure 9-15: Three buttons arranged in a bottom aligned OrientableFlowLayout.


The default is five pixels of vertical space in each direction in each orientation. Figure 9-16 shows ten buttons with 15 pixels of vertical space between each row and ten pixels of horizontal space between each column.


The source.