12.18.1 FlowLayout
FlowLayout
is the simplest layout manager. GUI components are placed in a container from left to right in the order in which they’re added to the container. When the edge of the container is reached, components continue to display on the next line. Class FlowLayout
allows GUI components to be left aligned, centered (the default) and right aligned.
The application of Figs. 12.39–12.40 creates three JButton
objects and adds them to the application, using a FlowLayout
. The components are center aligned by default. When the user clicks Left, the FlowLayout
’s alignment is changed to left aligned. When the user clicks Right, the FlowLayout
’s alignment is changed to right aligned. When the user clicks Center, the FlowLayout
’s alignment ...
Get Java™ How To Program (Early Objects), Tenth Edition 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.