Piet Souris wrote:I do not get a horizontal scroll bar. But if that is a problem, you can set the policy about the scrollbars. See the API of a JScrollPane. In my demo I set the width of the empty border right to 20, to allow for a scrollbar.
Piet Souris wrote:And a 0 in the contructor of a GridLayout does mean that that part is unspecified, and that you can add as many as you like. So, (0, 1) means one column, and as many rows as necessary. Likewise (1, 0) puts all the components in one row, no matter how many components.
Piet Souris wrote:The disadvantages of a GridLayout are: it does not respect preferredSizes, and it scales its components to fill the panel. But it is ideal for a demo.
Piet Souris wrote:Here is a simple demo that uses a GridLayout (has its disadvantages, but is very simple to use) and a JScrollPane.
Experiment with some other LayoutManagers and see what you like.
Campbell Ritchie wrote:Welcome to the Ranch
Campbell Ritchie wrote:Why are you using flow layout? What about box layout with a vertical alignment?