Hi,
I am writing a GUI which uses a GridBagLayout as its layout manager.
It basically has two columns: the first fills 30%, and the second 70% the width of the JFrame.
This seems to work fine except that when I add a JTextArea and set it to line wrap, it expands the second column to fill as far as it can without overwriting and of the components in the first column.
before setLineWrap(true);
col1 col2
|a | |
|b | JTexArea |
|c | |
after:
col1 col2
|a| |
|b| JTextArea.setLineWrap(true) |
|c| |
I hope the above helps to explain the situation.
This
only happens when I set the line wrapping. I want its fill setting to be BOTH, so that it fills its 70% of the width of JFrame. I have tried setting it to NONE, which shrinks it so it looks ridiculous. Setting its preferred and/or maximum size doesn't do anything, either.
Curiously, it doesn't do the same thing vertically, only horizontally.
Can anyone suggest why this is happening and how to fix it?
Cheers.