Word Wrap in Net Beans
Netbeans is great but there's no way to wrap text in it (or hopefully I haven't found it yet). Is there any way to do this, and if not, is there any similarly good IDE for Java with this functionality (hopefully free as well).
Asked by: John768 | Posted: 28-01-2022
Answer 1
You can use word wrap in Netbeans.
Add the following to netbeans.conf (netbeans_installation_path/etc/netbeans.conf, by default /etc/netbeans.conf under linux):
-J-Dorg.netbeans.editor.linewrap=true
to the sixth line so it looks like this:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.editor.linewrap=true"
and restart Netbeans.
Set the Line Wrap option in Tools->Options->Editor->Formating.
Works fine for me in Netbeans 6.9 and 7
Answered by: Brad231 | Posted: 01-03-2022Answer 2
If you do web development you are going to understand why text wrapping is important.
A programmer who has never gotten their hands dirty with HTML has never seen the real web. You can insist on MVC all you want to but 99.9% of the world wide web since its inception wasn't built that way. Unless you're always developing from a clean slate and can use MVC to separate the HTML out AND assuming you have an on-staff web designer who does html/css/javascript or you have an interface developer who you can fob it off on you WILL have to deal with everything that has been developed/kludged/hacked together with what ever technologies were at hand or popular or affordable at the time and now more or less functions as a 'web application'. And 99.9% of the time what you will have to work with is a mix of some kind of a programming language, most likely an interpreted one, with html and javascript all mixed in the same page.
And this means no nice short lines of neat clean java code that oh so conveniently end before 80 characters.
And when you deal with this -- which, dear hearts, is most of the web -- you magically discover the crying need for text wrapping to keep the long lines from making you scroll waaaay to the right to get to the end of it.
Some people. Sheesh. They think the whole universe of development has always fit on 80 characters per line, and from some of these comments, they seem to think it always will.
Answered by: Fiona856 | Posted: 01-03-2022Answer 3
Netbeans 7 is out and it supports word wrap out of the box!
Answered by: Ada916 | Posted: 01-03-2022Answer 4
There's word-wrap eclipse plugin: see http://ahtik.com/blog/eclipse-word-wrap/
Answered by: Samantha258 | Posted: 01-03-2022Answer 5
Like Joseph said: why would you need this. Java is not white space sensitive and having very long statements does not make your code easy to read.
Answered by: Anna188 | Posted: 01-03-2022Answer 6
It always goes back to Ultraedit.
Why can't we as a human race figure this out? netbeans, eclipse, zend studio (eclipse), etc don't do something very simple for programming, that most programmers -need to have- to keep a sound coding convention. Sure, it's true that coding style contributes to length of lines (erm microsoft programmers, perk your ears), but sometimes one cannot avoid long string literals. This is insanity! And yet I can't be mad or ungrateful because it's open source. And i -am- grateful. Still, one has to wonder wtf programmers who make these editors are actually using themselves.
I want an editor to wrap at column 80 or 120, not at the window's edge like notepad++. The only tool I've found that does hard/soft wrapping is ultraedit, so maybe I should try to see if I can get it to run under wine, since UE is the only 'real' editor that does it's job other than something weird / ugly / takes forever to learn and configure like emacs. And I am not going down that road- it gives me migranes to look at it because it's 2009 and we have cleartext and guis.
Is it really that difficult a problem to solve? If you draw a line down from column x and your word crosses over it, then put the beginning of the word under the indention of the line from which it started and mark the spill over row as a wrap row. Done.
Answered by: Eric459 | Posted: 01-03-2022Answer 7
Actually i heard netbeans is going to add word wrap feature in 6.7 release but then they decided to include this feature in 7.0 . hopefully we would see word wrap in the next release, according to few developers this isn't a necessary feature but for web developers this is totally needed.
Answered by: Daryl809 | Posted: 01-03-2022Answer 8
There is a great solution to this at this website blog.robbychen.com
The jist is to add the following line inside the quotes for netbeans_default_options inside the config file then restart netbeans:
-J-Dorg.netbeans.editor.linewrap=true
Answered by: Fenton803 | Posted: 01-03-2022
Answer 9
Except Eclipse does not support word wrap either, and they even don't have set up a target for this. Just like Netbeans, this has been asked by many users, but was never included. It appears it requires much change, and as well does not seem to be a high priority for devs. There was once a beginning of a plugin trying to word wrap in a limited way, but of course it does not work on recent versions.
Answered by: Cherry593 | Posted: 01-03-2022Answer 10
When you get to where you want the line to end, just start a new line without ending the statement. It may underline it in red until you end the statement, but it won't cause any exceptions.
I find that it is also a good way to organize long println() statements.
Answered by: Patrick495 | Posted: 01-03-2022Answer 11
Komodo Edit. In addition to its many other marvelous features, it actually wraps lines.
Answered by: John662 | Posted: 01-03-2022Answer 12
2 points:
Just found that wrapping is really needed if one wants to look into those damn SVG sources auto-generated when putting components from SVG palette...
I'm going to solve my current problem with seeing full SVG source by copy-paste to jEdit which is as configurable as Ultraedit (in the aspect of wrapping) and FoC!
Answer 13
As many have already noted, the answer is "you can't." As someone who uses Visual Studio and Eclipse-based products every day, when I am using Eclipse, I am constantly missing Visual Studio's line wrapping features, which I can turn on and off with a keystroke.
To the many people who have responded "you don't need this," stop being so condescending. Simply because you don't need a feature doesn't mean nobody else in the world does. Even if one were to religiously follow the advice "never have a line over 80 characters," you're going to need to edit code that others have composed and goes over 80 chars. And especially in the web-world, lines can get tremendously long. It's inevitable that you'll spend a lot of time looking at other people's code that goes way over 80 chars.
jEdit's line wrapping is very good. It preserves indentation and can be turned on an off very quickly. If I'm dealing with some very unwieldy long lines, I sometimes copy/paste in jEdit (which offers syntax highlighting for a myriad of languages) and use the line wrapping available there.
Answered by: Kristian264 | Posted: 01-03-2022Answer 14
The new version of Netbeans supports it. See this post for instructions:
Answered by: Melissa945 | Posted: 01-03-2022Answer 15
Of course word wrap is useful for coders - what about when you're writing README.txt files and you have to stick to coding standards like http://drupal.org/node/161085 where is says there needs to be an 80 character word wrap.
Answered by: Kellan209 | Posted: 01-03-2022Answer 16
In netbeans 7.3 you go to tools->options->editor->formatting, in the left menu area select the bottom most drop down that says line wrap, select your preference...done
Answered by: Fiona924 | Posted: 01-03-2022Answer 17
Get a bigger monitor.
At 1920 x 1080 you don't need no steenkin word-wrap.
Update: Wow, still getting downvotes. Maybe it's just how I said it. At least it hasn't caught up to the Eclipse answer yet.
I really thought this was a legitimate suggestion. I never thought that having a bigger monitor would make as much of a difference to coding as it has for me. If you're using a small monitor to code please consider getting a nice big new one. It does eliminate the need for word wrap in a lot of cases.
Answered by: Cherry540 | Posted: 01-03-2022Similar questions
java - JAXB - Beans to XSD or XSD to beans?
I have an existing data model. I would like to express this data model in terms of XML.
It looks like I have two options if I'm to use JAXB:
Create an XSD that mirrors my data model, and use xjc to create binding objects. Marshalling and unmarshalling will involve creating a "mapping" class that would take my existing data objects and map them to the objects that xjc created. For example, in my dat...
Java Enum with XML Beans?
When using Apache XML Beans to generate types from xsd:enumeration types, XMLBeans generates custom classes that are not Java 5 enums but some kind of special class to represent the enumeration.
This might be the case, because XMLBeans is older than Java 5 and there were no enums at the time or you still want to keep Java 1.4 compatibility. However, I would l...
java - Javabeans and JSP 2.0
So I'm trying to build a table based on the search results from a database access.
I'm searching for courses, so I have a javabean called CourseJBean, which has a number of fields and the appropriate getters and setters (e.g. for the field 'id', getId() and setId(newId) are used). I also have a javabean called searchJBean, which holds an ArrayList of CourseJBeans (the ArrayList is parametrized). This is me dealing ...
java - Send mail from JSF page using beans
i am creating a web application using jsf and primefaces, and my question is how to send an email through site's contact form (i've done this using php before, very easily, but never using jsf). I have created form on contact.xhtml page, as well as bean class to support that, and all that form should do is to send bean's data to a predefined mail (ie. gmail). I have also found several "tutorials" of how to send email using...
java - put all my beans in different file
I am using spring mvc and spring security. In my security-app-context.xml I have:
<authentication-manager>
<authentication-provider user-service-ref="MyUserDetailsService"/>
</authentication-manager>
And therefore I need to configure MyUserDetailsService in this security-app-context.xml file. So I added:
<beans:bean id="MyUserDetailsSer...
javabeans - When to use a java bean?
java - Using Beans in JSP
I'm coding a program in java that take a few information from a graph (X axis and Y axis), and then I need to take this information and pass to a JSP page.
this is the java
package view;
public class Axis{
double[] axisX;
double[] axisY;
int test;
public Axis(){
}
public void setAxisX(double[] axisX){
this.axisX = axisX;
}
public...
javabeans - Java Beans to test a class
I was given a class DrivingTestM.java to test with a 2 classes I wrote. Here are the classes I wrote. When i run the DrivingTestM.java it gives me an error with the line:
System.out.println( question.getDescription() );
Im not sure what the error may be. Can anyone try and shed some light on this error? Thanks!
Question.java:
public class Question {
String descripti...
PHP vs Java: Using Beans
I am a Java programmer and when we retrieve data from a database, we normally create a "Bean". Then using the setters of this bean, we will up the data into it, and pass it to other places.
Now, I am making a PHP application where I need to retrieve, insert data into a database. I know how to do it in the normal way, catch the HTML form information and pass it into a PHP file. I am wonderi...
java - How can a JSP page list two different beans in the same table?
I have a .jsp page with this code:
<tbody>
<c:forEach items="${companies}" var="companies">
<tr>
<td>${companies.id}</td>
<td>${companies.name}</td>
<td>${companies.email}</td>
<td>${companies.countryId}</td>
<td>${companies.sendToIdes}</td>
...
Still can't find your answer? Check out these amazing Java communities for help...
Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)