How to set Java FlowLayout to flow left, and control horizontal and vertical spacing
This code shows how to create a Java FlowLayout
that flows left and has horizontal spacing of ten pixels and vertical spacing of five pixels:
FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 10, 5); jPanel.setLayout(flowLayout);
Here’s what the FlowLayout
constructor arguments look like:
FlowLayout(int align, int horizontalSpacing, int verticalSpacing);
FlowLayout 'align' property definitions
The align
property can be any of these: