JTextArea setLineWrap problem

S

Sam

I'm working on a GUI which contains a couple of JTextAreas contained
in a JPanel with a border layout, one JTextArea occupying the north,
the other the center of the JPanel. The JPanel is contained in a
JScrollPane, which is in turn contained within a JSplitPane, left
side.

I have setLineWrap(true) for both of the JTextArea's mentioned above.
When I do this, the text lines wrap fine - even when I drag the split
pane border to the right to expand the viewing area. That is, the text
adjusts to the new (increased) size as one would expect. But when I
make the veiwing area smaller, the line wrap does not re-adjust to a
smaller area :) This is awkward because every display from that point
on seems to assume the text therein is the width of the size of the
JSplit's width at it's widest point. It makes the text display start
in the middle of the text somewhere, forcing the user to scroll back
toward the left to see the display starting from the left margin. It
should be doing nauturally.

What can I do to correct this problem?

Thanks,
Sam90
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top