C
Christopher Benson-Manica
The Java documentation says that a JTextArea's preferred size is what
is needed to display all the text. Why, then, does a text area
created by
final JTextArea content = new JTextArea("Long string goes here.");
content.setLineWrap(true);
content.setWrapStyleWord(true);
have a preferred size of 100x30, which is absolutely not big enough
to display all the text? What I want is to tell a text area how wide
of a space I want to put it in, and for it to tell me how much
vertical space it needs to display all of its text - how do I do that?
is needed to display all the text. Why, then, does a text area
created by
final JTextArea content = new JTextArea("Long string goes here.");
content.setLineWrap(true);
content.setWrapStyleWord(true);
have a preferred size of 100x30, which is absolutely not big enough
to display all the text? What I want is to tell a text area how wide
of a space I want to put it in, and for it to tell me how much
vertical space it needs to display all of its text - how do I do that?