1

I'm trying to build a simple interface for an assignment, in which multi-line word-wrapped input boxes can be stacked vertically in a single, fixed-width column. then the whole stack (if tall enough) has to scroll vertically inside of a scroll pane with the same fixed width and a fixed height.

The active box has to change height dynamically to fit the amount of text as it is being typed/deleted. This means the y position of all subsequent inputs in the column should change accordingly. A layout manager's job, right?

I started reading about the swing layouts, and it seemed like only the GridBagLayout could do this. Since this is my app's only interface window, it seemed like a clunky layout to achieve something simple.

So, which swing layout should I use, along with which text input class for word-wrapping and auto height adjustment? Thanks.

Ralph Oreg
  • 233
  • 1
  • 2
  • 10

1 Answers1

2

A BoxLayout might be what you are after for this use-case.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433