views:

6834

answers:

15

I'm just learning to code in java. Netbeans is great but I just found 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).

Thanks.

A: 

Try Eclipse. You won't look back! It's good looking, extremely fast and a wide spectrum of plugins. I can say for sure that NetBeans doesn't support Word Wrapping. They have targeted this for Netbeans 7. See this: http://www.netbeans.org/issues/show_bug.cgi?id=89894

askgelal
That's awful; turning this legitimate question into flamebate.
sjbotha
Netbeans is also a fine IDE. I admit it's a bit slower, but it's still perfectly usable and many things are easier to do with it.
sjbotha
More to the point, Eclipse doesn't have word-wrap either! See https://bugs.eclipse.org/bugs/show_bug.cgi?id=35779 ... You might want to try to upgrade to a more sophisticated text editor which implements this feature, like Notepad.
Tim Gilbert
Eclipse sux balls even more than NetBeans and btw - they BOTH do NOT have word wrap. There is a plugin for Eclipse tho..
Petrunov
use pspad instead, fast, lightweight, full featured!
aSeptik
A: 

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.

+1  A: 

There's word-wrap eclipse plugin: see http://ahtik.com/blog/eclipse-word-wrap/

A: 

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.

Joseph Burley
A: 

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.

Jeroen van Bergen
A: 

Get a bigger monitor.

At 1920 x 1080 you don't need no steenkin word-wrap.

sjbotha
+1  A: 

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.

A: 

Komodo Edit. In addition to its many other marvelous features, it actually wraps lines.

Darrell
A: 

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!

domi
+3  A: 

Wow, so none of you "I don't need word wrap" geniuses ever wrote a sentence longer than 80 characters that is contained in one command?

Peter
we split such lines into multiple lines at convenient positions rather than leaving the point of breaking to IDE - that way, it'd be more readable.
Amarghosh
@Amarghosh: More readable now, at the cost of making it harder to edit, or god forbid, translate. As a translator, I get files formated as you recommend all the f***g time, with sentences broken into 3 pieces or more, lots of extra spaces and tabs. A complete mess. Wordwrap is a pretty normal feature for a text editor, and if implementing wordwrap breaks the editor, sorry, but it is just not implemented properly.
Sylverdrag
@Sylverdrag I thought we were talking about code.
Amarghosh
@Amarghosh: And you think that code never contains translatable text? Think again. Ideally, there shouldn't, but in actual fact, there is. Tons of it. And that's without even talking about web development, for which NetBeans is also a popular editor (HTML/XML without translatable strings, anyone?) Coders happily type hard return in the middle of sentences, thinking that all that matters is that it looks nice and readable. Translating that is a huge mess, as it throws off the segmentation engines of all the translation tools on the market.
Sylverdrag
+4  A: 

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.

webdev
A: 

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.

A: 

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, longs 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.

Joshua Beall
A: 

Emacs handles word wrapping pretty well. I, too, wish NetBeans had a word wrap option. I don't write code with super long lines, but others do, and right now I have to edit a bunch of code with lines that are hundreds of bytes long.

This isn't a religious issue. It's a practical problem, but most of the responses here are from junior programmers who don't have a clue.

Terry
+1  A: 

You can use word wrap in Netbeans.

Add to netbeans.conf (netbans_instalation_path/etc/netbeans.conf):

-J-Dorg.netbeans.editor.linewrap=true

and restart Netbeans.

In Options->Editor->Formating there is Line Wrap dropdown option

Works fine for me in Netbeans 6.9

Sidarta