Wrap « JTextArea « Java Swing Q&A





1. enabling smarter text wrapping in a JTextArea    stackoverflow.com

The Context At the moment, I have a JTextArea that has been created like so:

JTextArea descArea = new JTextArea();
descArea.setFont(style.getFont());
descArea.setLineWrap(true);
descArea.setName("descArea");
descArea.setToolTipText(resourceMap.getString("descArea.toolTipText"));
descArea.setText(model.getName());
JScrollPane descPane = new JScrollPane(descArea,
          ...

2. JTextArea wrap line with CR LF    stackoverflow.com

I want to read a file and wrap its lines into a JTextArea when the reading encounter a CR LF value. JTextArea has methods like setLineWrap and setWrapStyleWord that doesn't do that! Thanks. ...

3. Determining text offset of a JTextArea line when wrapping    stackoverflow.com

I am trying to determine the bounds of a line of text in my text area. I know that I can determine the bounds for an offset, which means I ...

4. Why do JTextArea and TextLayout wrap words differently?    stackoverflow.com

We have an app that draws text, but then displays a JTextArea for the user to edit the text when they click on the text. However, the wrapping between these two ...

5. JTextArea: how to wrap text by words, not characters?    stackoverflow.com

I want to avoid an output like this: Here is some text t
hat is being wrappe
d by characters, sp
litting words in ha
lf I am using a JTextArea, with setLineWrap(true). How can ...

6. How to count the number of lines in a JTextArea, including those caused by wrapping?    stackoverflow.com

I have a JTextArea for which I have set word-wrap and wrap-style-word to true. I want to "pack" the JTextArea to the minimum possible height given a specified width. To do this, ...

7. JTextArea line wrap    coderanch.com

8. TextArea: controlling text wrap?    coderanch.com

9. word wrap styled text area?    coderanch.com





10. Word wrap in JTextArea    coderanch.com

Hi, I am in the process of learning about Swing and have a question regarding the use of JTextAreas. I searched this thread for previous posts on the topic but didn't find anything that solved my problem. The below code works fine in the appletviewer, but not when embedded in a web page. That is, the inputdialogs work but not the ...

12. Limiting characters and word wrap in JTextArea    coderanch.com

Hi there. I found some code on Sun's website that allows me to limit the number of columns and rows in a JTextArea component as follows: public class MaximumSizeFilter extends DocumentFilter { private final int maxRows; private final int maxCols; /** * Creates a new MaximumSizeFilter with a given row/column limit. * This Filter limits the associated JTextComponent to this number ...

13. JTextArea Wrap Around or something?    java-forums.org

Hello, I'm trying to set an area in my GUI that will display information as required. This area is a textured Panel so I want this text area to be see through. The closest I have gotten is using a JTextField and setting opaque to false but I can only get the text to go in a stright line and not ...