> How do I make the text in my JTextArea wrap so that I dont need a horizontal
> scrollbar? I tried setting it to not scroll horizantally ever but the text
[quoted text clipped - 3 lines]
> Thanks.
> Allan
myJTextArea.setLineWrap(true);
myJTextArea.setWrapStyleWord(true);

Signature
Regards,
Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
Allan Bruce - 02 Jun 2005 23:03 GMT
>> How do I make the text in my JTextArea wrap so that I dont need a
>> horizontal scrollbar? I tried setting it to not scroll horizantally ever
[quoted text clipped - 5 lines]
> myJTextArea.setLineWrap(true);
> myJTextArea.setWrapStyleWord(true);
Perfect, thanks!
Allan
> From: "Allan Bruce" <amb@abc.net>
> How do I make the text in my JTextArea wrap so that I dont need a
> horizontal scrollbar?
Given that you already knew the name of the class you are working with,
and obviously you have some sort of online access to the net, why
didn't you look in the API documentation, in the list of classes for
J2SE, for example I use 1.3.1 so I'd look here:
http://java.sun.com/j2se/1.3/docs/api/allclasses-frame.html
and then do a simple search for the name of your class on that Web
page, which would turn up the link to this:
http://java.sun.com/j2se/1.3/docs/api/javax/swing/JTextArea.html
and then searching down the list of methods you'd see the link to this:
http://java.sun.com/j2se/1.3/docs/api/javax/swing/JTextArea.html#setLineWrap(boolean)
not to mention that up at the start of the page for that whole class
there's an explanatory section that says this:
... JTextArea has a bound property for line wrapping that
controls whether or not it will wrap lines. By default, the line
wrapping property is set to false (not wrapped).
Did you fail to see either that descriptive text or the late specific
method for setting line-wrap property? Or did you not even bother to
look at the API before posting? The Java API has a few typos here and
there, but generally is mostly correct and very easy to use online. Try
it, you'll like it!
And for times when you can't be online and just need a list of method
and constructor signatures without the full English-language
descriptive text, BeanShell has a fine class browser, I discovered a
few days ago, and it includes not just the Java API, but any other
classes you have in your classpath, including other packages (such as
BeanShell itself) you've downloaded as well as all your own classes
whether in packages or not.