I’m using a JTextArea to display a long text
JTextArea _definition = new JTextArea(5, 50);
with word-wrap
_definition.setLineWrap(true); _definition.setWrapStyleWord(true);
embedded in a JScrollPane
add(new JScrollPane(_definition), gbc);
All that is part of a JPanel with the GridBagLayout.
Everything is working fine with shorter text, but when I add a long text with line wraps and the scrollbar is required, pack() goes south and all components have just a minimum size and the dialog is unusable (it’s not only the TextArea that is affected).
I’ve tried to figure out what is going on, but all I could figure out is that is has to do with the text in the TextArea. I’m stuck .. any ideas? Thanks!
Got it to work .. Ross’s answer was giving me some better terms to search for, so thanks for helping me by pointing in the right direction!
So double-packing plus some extra … strange behavior.