Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How do I fix a jcomponent?

  Asked By: Egidius    Date: Jun 19    Category: Java    Views: 745
  

I have a problem. I have been assigned to create a word processor at my
university as a part of a course. It works fine, except that I can't get it to
print "infinite" lines of text, that is without "\n". There is as far as I know
no easy way to tokenise it. LinebreakMeasurer is not working with the graphic
components that I chose. Can I fix the width as the user enters input? Or can
it add a "\n" wherever the user gets to the end of a line as he or her enters
text into a JTextArea which I have chosen to use. It seems to have two "ugly"
functions, just line-wraps or lets the stuff get way out into infinity. I'm very
thankful whatever somebody can do to help.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Terence Mitchell     Answered On: Jun 19

Set your JTextArea to automatically wrap at a word  boundary as in the
following snippet:

JTextArea myTextArea = new JTextArea();
myTextArea.setLineWrap(true);
myTextArea.setWrapStyleWord(true);

 
Didn't find what you were looking for? Find more on How do I fix a jcomponent? Or get search suggestion and latest updates.




Tagged: